Add number of sheets as a unit for number of parts
This commit is contained in:
2 files changed
+5
-1
No files matched your search
@@ -12,6 +12,7 @@
|
||||
enum MDCountPartsUnit implements MDValueEnumInterface, JsonSerializable, MDMeasurementUnitInterface {
|
||||
|
||||
case parts;
|
||||
case sheets;
|
||||
case pages;
|
||||
|
||||
/**
|
||||
@@ -26,6 +27,7 @@ public static function fromString(string $input):MDCountPartsUnit {
|
||||
return match($input) {
|
||||
'parts' => self::parts,
|
||||
'pages' => self::pages,
|
||||
'sheets' => self::sheets,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown parts counting unit"),
|
||||
};
|
||||
|
||||
@@ -43,6 +45,7 @@ public static function fromInt(int $input):MDCountPartsUnit {
|
||||
return match($input) {
|
||||
1 => self::parts,
|
||||
2 => self::pages,
|
||||
3 => self::sheets,
|
||||
default => throw new MDpageParameterNotFromListException("Unknown parts counting unit"),
|
||||
};
|
||||
|
||||
@@ -80,6 +83,7 @@ public function toInt():int {
|
||||
return match($this) {
|
||||
self::parts => 1,
|
||||
self::pages => 2,
|
||||
self::sheets => 3,
|
||||
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user