1 | <?php |
||
14 | trait EnumTrait |
||
15 | { |
||
16 | /** |
||
17 | * Array for titles. Just default dummy for override if need |
||
18 | * |
||
19 | * @return array |
||
20 | */ |
||
21 | static protected function titles() : array |
||
25 | |||
26 | /** |
||
27 | * Main function. Return list of constants i.e. keys and values... |
||
28 | * |
||
29 | * @return array |
||
30 | */ |
||
31 | static public function data() : array |
||
37 | |||
38 | /** |
||
39 | * Get iterator for titles/keys/values |
||
40 | * |
||
41 | * @return \Iterator |
||
42 | */ |
||
43 | static public function titlesIterator() : \Iterator |
||
54 | |||
55 | /** |
||
56 | * Return all keys and his titles (defined at titles() or default generated) |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | static public function keyTitles() : array |
||
69 | |||
70 | /** |
||
71 | * Return all values and his titles (defined at titles() or default generated) |
||
72 | * |
||
73 | * @return array |
||
74 | */ |
||
75 | static public function valueTitles() : array |
||
84 | |||
85 | /** |
||
86 | * Get value by key |
||
87 | * @param string $key |
||
88 | * @return mixed |
||
89 | */ |
||
90 | static public function value(string $key) |
||
94 | |||
95 | /** |
||
96 | * Get key by value |
||
97 | * @param mixed $value |
||
98 | * @return string|null |
||
99 | */ |
||
100 | static public function key($value) : ?string |
||
105 | |||
106 | static public function checkKey(string $key) : void |
||
112 | |||
113 | } |
||
114 |