Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace DevToolbelt\Enums; |
| 6 | |
| 7 | /** |
| 8 | * Interface for all enums in the Dev-Toolbelt Enums library. |
| 9 | * |
| 10 | * This interface ensures consistency across all enum implementations |
| 11 | * by requiring common methods for retrieving descriptive names and |
| 12 | * converting enum cases to arrays. |
| 13 | */ |
| 14 | interface EnumInterface |
| 15 | { |
| 16 | /** |
| 17 | * Get the full descriptive name of the enum case. |
| 18 | * |
| 19 | * @return string The human-readable name |
| 20 | */ |
| 21 | public function label(): string; |
| 22 | |
| 23 | /** |
| 24 | * Get all labels as a simple indexed array. |
| 25 | * |
| 26 | * @return string[] |
| 27 | */ |
| 28 | public function labelList(): array; |
| 29 | |
| 30 | /** |
| 31 | * Get all enum cases as an associative array with values as keys and values. |
| 32 | * |
| 33 | * @return array<string|int, string|int> |
| 34 | */ |
| 35 | public static function toArray(): array; |
| 36 | |
| 37 | /** |
| 38 | * Get all enum cases as an associative array with values as keys and labels as values. |
| 39 | * |
| 40 | * @return array<string|int, string> |
| 41 | */ |
| 42 | public static function toArrayWithLabels(): array; |
| 43 | } |