1 | <?php |
||
10 | abstract class Enum extends PhpEnum |
||
11 | { |
||
12 | use EnumTransferKeys, EnumDefaultKey; |
||
13 | |||
14 | /** |
||
15 | * Get the key for the given value. |
||
16 | * |
||
17 | * @param mixed $value |
||
18 | * @return mixed |
||
19 | */ |
||
20 | public static function key($value) |
||
24 | |||
25 | /** |
||
26 | * Get the value for the given key. |
||
27 | * |
||
28 | * @param mixed $key |
||
29 | * @return mixed |
||
30 | */ |
||
31 | public static function value($key) |
||
39 | |||
40 | /** |
||
41 | * Get all values. |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | public static function allValues() |
||
49 | |||
50 | /** |
||
51 | * Get all keys. |
||
52 | * |
||
53 | * @return array |
||
54 | */ |
||
55 | public static function allKeys() |
||
61 | |||
62 | /** |
||
63 | * Get the key for the given value. |
||
64 | * |
||
65 | * @param mixed $value |
||
66 | * @return mixed |
||
67 | */ |
||
68 | public static function search($value) |
||
78 | |||
79 | /** |
||
80 | * Check if is valid enum key. |
||
81 | * |
||
82 | * @param mixed $key |
||
83 | * @return bool |
||
84 | */ |
||
85 | public static function isValidKey($key) |
||
89 | |||
90 | /** |
||
91 | * Returns a value when called statically like so: |
||
92 | * MyEnum::SOME_VALUE() given SOME_VALUE is a class constant |
||
93 | * |
||
94 | * @param string $name |
||
95 | * @param array $arguments |
||
96 | * @return static |
||
97 | */ |
||
98 | public static function __callStatic($name, $arguments) |
||
102 | } |
||
103 |