| Total Complexity | 7 |
| Total Lines | 63 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 10 | abstract class Enum |
||
| 11 | { |
||
| 12 | private string $value; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Enum constructor. |
||
| 16 | * @param string $value |
||
| 17 | * @throws EnumException |
||
| 18 | */ |
||
| 19 | 5 | public function __construct(string $value) |
|
| 20 | { |
||
| 21 | 5 | $this->validate($value); |
|
| 22 | 3 | $this->value = $value; |
|
| 23 | 3 | } |
|
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $value |
||
| 27 | * @throws EnumException |
||
| 28 | */ |
||
| 29 | 5 | private function validate(string $value): void |
|
| 46 | } |
||
| 47 | 3 | } |
|
| 48 | |||
| 49 | /** |
||
| 50 | * @return string[] |
||
| 51 | * @throws ReflectionException |
||
| 52 | */ |
||
| 53 | 5 | private function getConstants(): array |
|
| 54 | { |
||
| 55 | 5 | $class = new ReflectionClass($this); |
|
| 56 | 5 | return $class->getConstants(); |
|
| 57 | } |
||
| 58 | |||
| 59 | 1 | public function __toString(): string |
|
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @return mixed[] |
||
| 66 | * @throws ReflectionException |
||
| 67 | */ |
||
| 68 | 1 | public function __debugInfo(): array |
|
| 76 |