| 1 | <?php |
||
| 14 | trait EnumTrait |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Array for titles. Just default dummy for override if need |
||
| 18 | * @return array |
||
| 19 | */ |
||
| 20 | static protected function titles() : array |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Main function. Return list of constants i.e. keys and values... |
||
| 27 | * @return array |
||
| 28 | */ |
||
| 29 | static public function data() : array |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Return all keys and his titles (defined at titles() or default generated) |
||
| 38 | * @return array |
||
| 39 | */ |
||
| 40 | static public function keyTitles() : array |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Return all values and his titles (defined at titles() or default generated) |
||
| 52 | * @return array |
||
| 53 | */ |
||
| 54 | static public function valueTitles() : array |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Get value by key |
||
| 66 | * @param string $key |
||
| 67 | * @return mixed |
||
| 68 | */ |
||
| 69 | static public function value(string $key) |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Get key by value |
||
| 76 | * @param mixed $value |
||
| 77 | * @return string|null |
||
| 78 | */ |
||
| 79 | static public function key($value) : ?string |
||
| 84 | |||
| 85 | } |
||
| 86 |