Total Complexity | 6 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
21 | abstract class EnumerableConstants |
||
22 | { |
||
23 | /** |
||
24 | * @return array |
||
25 | * |
||
26 | * @throws \ReflectionException |
||
27 | */ |
||
28 | public static function enum() |
||
29 | { |
||
30 | $ref = new \ReflectionClass(new static()); |
||
31 | $constants = $ref->getConstants(); |
||
32 | |||
33 | return $constants; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param mixed $value |
||
38 | * @return mixed |
||
39 | * |
||
40 | * @throws \ReflectionException |
||
41 | */ |
||
42 | public static function constantNameByValue($value) |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param string $name |
||
55 | * |
||
56 | * @return mixed|null |
||
57 | * |
||
58 | * @throws \ReflectionException |
||
59 | */ |
||
60 | public static function valueOf($name) |
||
67 |