Total Complexity | 9 |
Total Lines | 69 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class TeamRequestStatus |
||
10 | { |
||
11 | public const ACTIVE = 'ACTIVE'; |
||
12 | public const ACCEPTED = 'ACCEPTED'; |
||
13 | public const CANCELED = 'CANCELED'; |
||
14 | public const REFUSED = 'REFUSED'; |
||
15 | |||
16 | |||
17 | public const VALUES = [ |
||
18 | self::ACTIVE, |
||
19 | self::ACCEPTED, |
||
20 | self::CANCELED, |
||
21 | self::REFUSED, |
||
22 | ]; |
||
23 | |||
24 | private string $value; |
||
25 | |||
26 | public function __construct(string $value) |
||
27 | { |
||
28 | self::inArray($value); |
||
29 | |||
30 | $this->value = $value; |
||
31 | } |
||
32 | |||
33 | public static function inArray(string $value): void |
||
34 | { |
||
35 | Assert::inArray($value, self::VALUES); |
||
36 | } |
||
37 | |||
38 | public function getValue(): string |
||
39 | { |
||
40 | return $this->value; |
||
41 | } |
||
42 | |||
43 | public function __toString(): string |
||
46 | } |
||
47 | |||
48 | public function isActive(): bool |
||
51 | } |
||
52 | |||
53 | public function isAccepted(): bool |
||
54 | { |
||
55 | return self::ACCEPTED === $this->value; |
||
56 | } |
||
57 | |||
58 | public function isRefused(): bool |
||
59 | { |
||
60 | return self::REFUSED === $this->value; |
||
61 | } |
||
62 | |||
63 | public function isCanceled(): bool |
||
64 | { |
||
65 | return self::CANCELED === $this->value; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return array |
||
70 | */ |
||
71 | public static function getStatusChoices(): array |
||
78 | ]; |
||
79 | } |
||
80 | } |
||
81 |