Skip to content

API reference / Quittio \ Core \ Enums

UnitCode

string-backed enum in quittio/core · uses HasLabel

Quittio\Core\Enums\UnitCode · Source

Unit of measure (BT-130, BT-150), UN/ECE Recommendation 20 and 21. Further codes can be used as RawCode.

Cases#

CaseValueDescription
Unit'C62'
Piece'H87'
Set'SET'
Pair'PR'
Dozen'DZN'
LumpSum'LS'
Second'SEC'
Minute'MIN'
Hour'HUR'
Day'DAY'
Week'WEE'
Month'MON'
Quarter'QAN'
Year'ANN'
Gram'GRM'
Kilogram'KGM'
Tonne'TNE'
Millimetre'MMT'
Centimetre'CMT'
Metre'MTR'
Kilometre'KMT'
SquareMetre'MTK'
CubicMetre'MTQ'
Millilitre'MLT'
Litre'LTR'
KilowattHour'KWH'
Kilowatt'KWT'
Percent'P1'
ServiceUnit'E48'
Package'XPK'
Box'XBX'
Pallet'XPX'

Methods#

MethodDescription
::isValidCode()Whether a raw code value is valid according to the official code list.
->label()Translated label of the code in $locale (null: the translator's locale), e.g. "Stunde" for HUR; the code itself when neither $locale nor English has a label.
::labelGroup()The labels of these codes are under "unit" in resources/lang/{locale}/codes.php (see label()).

isValidCode()#

public static function isValidCode(string $code): bool

static

Whether a raw code value is valid according to the official code list.

ParameterTypeDescription
$codestring
Returns
bool

label()#

public function label(?string $locale = null): string

Translated label of the code in $locale (null: the translator's locale), e.g. "Stunde" for HUR; the code itself when neither $locale nor English has a label.

ParameterTypeDescription
$locale?string = null
Returns
string

labelGroup()#

public static function labelGroup(): string

static

The labels of these codes are under "unit" in resources/lang/{locale}/codes.php (see label()).

Returns
string

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.