1 | <?php |
||
6 | * @author Eric Braun <[email protected]> |
||
7 | */ |
||
8 | abstract class Enum |
||
9 | { |
||
10 | /** @var array */ |
||
11 | protected static $cache; |
||
12 | |||
13 | /** |
||
14 | * @param string|int $value |
||
15 | * |
||
16 | * @return bool |
||
17 | */ |
||
18 | public static function isValid($value) |
||
22 | |||
23 | /** |
||
24 | * @return array |
||
25 | */ |
||
26 | public static function getValues() |
||
27 | { |
||
28 | if (!isset(static::$cache[static::class])) { |
||
29 | $reflection = new \ReflectionClass(static::class); |
||
30 | static::$cache[static::class] = $reflection->getConstants(); |
||
31 | } |
||
32 | |||
33 | return static::$cache[static::class]; |
||
34 | } |
||
36 |