Oihana PHP Standards

MeasureCode uses ConstantsTrait

UN/CEFACT Unit of Measure Codes Enumeration Class (Recommendation 20).

This class exposes an extended selection of the most commonly used codes across various commercial and logistical contexts.

It mirrors MeasureName and MeasureSymbol : the three classes declare the same constant names, which is what the cross lookups rely on.

⚠️ Generated by tools/generate-uncefact-rec20.php — do not edit by hand. Edit tools/data/uncefact-rec20-selection.csv and run the generator instead.

Tags
see
https://unece.org/trade/uncefact/cl-recommendations

Table of Contents

Constants

ACRE  : string = 'ACR'
ACRE_FOOT  : string = 'M67'
AMPERE  : string = 'AMP'
ANGULAR  : string = 'DD'
BAR  : string = 'BAR'
BARREL  : string = 'BLL'
BECQUEREL  : string = 'BQL'
BIT  : string = 'A99'
BYTE  : string = 'AD'
CALORIE  : string = 'R4'
CARAT  : string = 'CTM'
CELSIUS  : string = 'CEL'
CENTILITRE  : string = 'CLT'
CENTIMETER  : string = 'CMT'
COULOMB  : string = 'COU'
CUBIC_CENTIMETER  : string = 'CMQ'
CUBIC_DECIMETER  : string = 'DMQ'
CUBIC_FOOT  : string = 'FTQ'
CUBIC_METER  : string = 'MTQ'
DAY  : string = 'DAY'
DECIBEL  : string = '2N'
DOZEN  : string = 'DZN'
FAHRENHEIT  : string = 'FAH'
FARAD  : string = 'FAR'
FOOT  : string = 'FOT'
GIGABYTE  : string = 'E34'
GRAM  : string = 'GRM'
GRAY  : string = 'A95'
GROSS  : string = 'GRO'
HECTARE  : string = 'HAR'
HECTOMETER  : string = 'HMT'
HENRY  : string = '81'
HERTZ  : string = 'HTZ'
HOUR  : string = 'HUR'
HUNDRED  : string = 'CEN'
IMPERIAL_GALLON  : string = 'GLI'
INCH  : string = 'INH'
JOULE  : string = 'JOU'
KELVIN  : string = 'KEL'
KILOBYTE  : string = '2P'
KILOCALORIE  : string = 'E14'
KILOGRAM  : string = 'KGM'
KILOGRAM_PER_CUBIC_METER  : string = 'KMQ'
KILOHERTZ  : string = 'KHZ'
KILOJOULE  : string = 'KJO'
KILOMETER  : string = 'KMT'
KILOWATT  : string = 'KWT'
KILOWATT_HOUR  : string = 'KWH'
LITER  : string = 'LTR'
LUMEN  : string = 'LUM'
LUX  : string = 'LUX'
MEGABYTE  : string = '4L'
MEGAHERTZ  : string = 'MHZ'
METER  : string = 'MTR'
METRIC_TON  : string = 'TNE'
MILE  : string = 'SMI'
MILLIBAR  : string = 'MBR'
MILLIGRAM  : string = 'MGM'
MILLILITER  : string = 'MLT'
MILLIMETER  : string = 'MMT'
MINUTE  : string = 'MIN'
MONTH  : string = 'MON'
NEWTON  : string = 'NEW'
OHM  : string = 'OHM'
OUNCE  : string = 'ONZ'
PAIR  : string = 'PR'
PARTS_PER_MILLION  : string = '59'
PASCAL  : string = 'PAL'
PER_THOUSAND  : string = 'NX'
PERCENT  : string = 'P1'
PIECE  : string = 'H87'
POUND  : string = 'LBR'
POUND_FORCE  : string = 'C78'
POUND_PER_SQUARE_INCH  : string = 'PS'
RADIAN  : string = 'C81'
REVOLUTION_PER_MINUTE  : string = 'RPM'
SCORE  : string = 'SCO'
SECOND  : string = 'SEC'
SIEMENS  : string = 'SIE'
SIEVERT  : string = 'D13'
SQUARE_CENTIMETER  : string = 'CMK'
SQUARE_DECIMETER  : string = 'DMK'
SQUARE_FOOT  : string = 'FTK'
SQUARE_INCH  : string = 'INK'
SQUARE_KILOMETER  : string = 'KMK'
SQUARE_METER  : string = 'MTK'
SQUARE_MILE  : string = 'MIK'
SQUARE_MILLIMETER  : string = 'MMK'
SQUARE_YARD  : string = 'YDK'
TEN_PAIRS  : string = 'TPR'
TESLA  : string = 'D33'
THOUSAND  : string = 'MIL'
UNIT  : string = 'C62'
US_GALLON  : string = 'GLL'
VOLT  : string = 'VLT'
WATT  : string = 'WTT'
WEBER  : string = 'WEB'
WEEK  : string = 'WEE'
YARD  : string = 'YRD'
YEAR  : string = 'ANN'

Properties

$NAMES  : array<string|int, mixed>|null
$SYMBOLS  : array<string|int, mixed>|null

Methods

getFromName()  : string|null
Returns the code matching a specific unit name.
getFromSymbol()  : string|null
Returns the code matching a specific unit symbol.
getName()  : string|null
Returns the official UN/CEFACT name for a given code.
getSymbol()  : string|null
Returns the official UN/CEFACT symbol for a given code.
resetCaches()  : void
Reset the internal cache of the static methods.

Constants

CUBIC_CENTIMETER

public string CUBIC_CENTIMETER = 'CMQ'

CUBIC_DECIMETER

public string CUBIC_DECIMETER = 'DMQ'

IMPERIAL_GALLON

public string IMPERIAL_GALLON = 'GLI'

KILOGRAM_PER_CUBIC_METER

public string KILOGRAM_PER_CUBIC_METER = 'KMQ'

PARTS_PER_MILLION

public string PARTS_PER_MILLION = '59'

POUND_PER_SQUARE_INCH

public string POUND_PER_SQUARE_INCH = 'PS'

REVOLUTION_PER_MINUTE

public string REVOLUTION_PER_MINUTE = 'RPM'

SQUARE_CENTIMETER

public string SQUARE_CENTIMETER = 'CMK'

SQUARE_DECIMETER

public string SQUARE_DECIMETER = 'DMK'

SQUARE_KILOMETER

public string SQUARE_KILOMETER = 'KMK'

SQUARE_MILLIMETER

public string SQUARE_MILLIMETER = 'MMK'

Properties

$NAMES

private static array<string|int, mixed>|null $NAMES = null

$SYMBOLS

private static array<string|int, mixed>|null $SYMBOLS = null

Methods

getFromName()

Returns the code matching a specific unit name.

public static getFromName(string $name) : string|null
Parameters
$name : string

The UN/CEFACT name (e.g., 'Kilogram').

Return values
string|null

The UN/CEFACT code (e.g., 'KGM') or null if not found.

getFromSymbol()

Returns the code matching a specific unit symbol.

public static getFromSymbol(string $symbol) : string|null
Parameters
$symbol : string

The UN/CEFACT symbol (e.g., 'kg').

Return values
string|null

The UN/CEFACT code (e.g., 'KGM') or null if not found.

getName()

Returns the official UN/CEFACT name for a given code.

public static getName(string $code) : string|null
Parameters
$code : string

The UN/CEFACT code (e.g., 'KGM').

Return values
string|null

The UN/CEFACT name (e.g., 'Kilogram') or null if not found.

getSymbol()

Returns the official UN/CEFACT symbol for a given code.

public static getSymbol(string $code) : string|null
Parameters
$code : string

The UN/CEFACT code (e.g., 'KGM').

Return values
string|null

The UN/CEFACT symbol (e.g., 'kg') or null if not found.

resetCaches()

Reset the internal cache of the static methods.

public static resetCaches() : void
On this page

Search results