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