| Total Complexity | 7 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class ForumStatus |
||
| 10 | { |
||
| 11 | public const PUBLIC = 'public'; |
||
| 12 | public const PRIVATE = 'private'; |
||
| 13 | |||
| 14 | public const VALUES = [ |
||
| 15 | self::PUBLIC, |
||
| 16 | self::PRIVATE, |
||
| 17 | ]; |
||
| 18 | |||
| 19 | private string $value; |
||
| 20 | |||
| 21 | public function __construct(string $value) |
||
| 22 | { |
||
| 23 | self::inArray($value); |
||
| 24 | |||
| 25 | $this->value = $value; |
||
| 26 | } |
||
| 27 | |||
| 28 | public static function inArray(string $value): void |
||
| 29 | { |
||
| 30 | Assert::inArray($value, self::VALUES); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function getValue(): string |
||
| 34 | { |
||
| 35 | return $this->value; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function isPrivate(): bool |
||
| 39 | { |
||
| 40 | return $this->value === self::PRIVATE; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function isPublic(): bool |
||
| 44 | { |
||
| 45 | return $this->value === self::PUBLIC; |
||
| 46 | } |
||
| 47 | |||
| 48 | public function __toString(): string |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return string[] |
||
| 55 | */ |
||
| 56 | public static function getStatusChoices(): array |
||
| 61 | ]; |
||
| 62 | } |
||
| 63 | } |
||
| 64 |