1 | <?php |
||
9 | final class StatusType |
||
10 | { |
||
11 | private const AVAILABLE = 'Available'; |
||
12 | private const TEMPORARILY_UNAVAILABLE = 'TemporarilyUnavailable'; |
||
13 | private const UNAVAILABLE = 'Unavailable'; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $value; |
||
19 | |||
20 | /** |
||
21 | * @var string[] |
||
22 | */ |
||
23 | private const ALLOWED_VALUES = [ |
||
24 | self::AVAILABLE, |
||
25 | self::TEMPORARILY_UNAVAILABLE, |
||
26 | self::UNAVAILABLE, |
||
27 | ]; |
||
28 | |||
29 | private function __construct(string $value) |
||
36 | |||
37 | public static function available(): StatusType |
||
41 | |||
42 | public static function temporarilyUnavailable(): StatusType |
||
46 | |||
47 | public static function unavailable(): StatusType |
||
51 | |||
52 | public function toNative(): string |
||
56 | |||
57 | public static function fromNative(string $value): StatusType |
||
61 | |||
62 | public function equals(StatusType $status): bool |
||
66 | } |
||
67 |