1 | <?php |
||
7 | final class Status |
||
8 | { |
||
9 | const ACTIVE = 'active'; |
||
10 | const BLOCKED = 'blocked'; |
||
11 | |||
12 | /** @var string */ |
||
13 | private $status; |
||
14 | |||
15 | /** |
||
16 | * @param string $status |
||
17 | * |
||
18 | * @throws InvalidStatusException |
||
19 | */ |
||
20 | private function __construct($status) |
||
28 | |||
29 | /** |
||
30 | * @param string $status |
||
31 | * |
||
32 | * @return Status |
||
33 | */ |
||
34 | public static function fromString($status) |
||
38 | |||
39 | /** |
||
40 | * @return array |
||
41 | */ |
||
42 | public static function getPossibleStatuses() |
||
51 | |||
52 | /** |
||
53 | * @return Status |
||
54 | */ |
||
55 | public static function active() |
||
59 | |||
60 | /** |
||
61 | * @return Status |
||
62 | */ |
||
63 | public static function blocked() |
||
67 | |||
68 | /** |
||
69 | * @return bool |
||
70 | */ |
||
71 | public function isBlocked() |
||
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | public function __toString() |
||
83 | } |
||
84 |