1 | <?php |
||
35 | abstract class AbstractEnum |
||
36 | { |
||
37 | /** @var array */ |
||
38 | private static $ConstantsCache = []; |
||
39 | |||
40 | /** |
||
41 | * Get all constants of called class. |
||
42 | * |
||
43 | * This static methods uses an internal cache to not create a reflection on every call. |
||
44 | * |
||
45 | * @return array a hash with your constants and their value |
||
46 | */ |
||
47 | 4 | public static function getEnum() |
|
58 | |||
59 | /** |
||
60 | * Checks whether a constant is valid. |
||
61 | * |
||
62 | * @param string $name name of the constant |
||
63 | * @param bool $strict whether to make a case sensitive check |
||
64 | * |
||
65 | * @return bool the result of the test |
||
66 | */ |
||
67 | 1 | public static function isValidName($name, $strict = false) |
|
79 | |||
80 | /** |
||
81 | * Checks whether a value is defined. |
||
82 | * |
||
83 | * @param int|string $value the value to test |
||
84 | * @param bool $strict check the types of the value in the values |
||
85 | * |
||
86 | * @return bool the result of the test |
||
87 | */ |
||
88 | 1 | public static function isValidValue($value, $strict = true) |
|
94 | } |
||
95 |