| 1 | <?php |
||
| 11 | class EnumRegistry |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var EnumInterface[] |
||
| 15 | */ |
||
| 16 | private $enums; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param EnumInterface $enum |
||
| 20 | * |
||
| 21 | * @throws DuplicatedEnumException |
||
| 22 | */ |
||
| 23 | 3 | public function add(EnumInterface $enum) |
|
| 31 | |||
| 32 | /** |
||
| 33 | * @param string $name |
||
| 34 | * |
||
| 35 | * @return EnumInterface |
||
| 36 | * @throws InvalidEnumException |
||
| 37 | */ |
||
| 38 | 2 | public function get($name) |
|
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $name |
||
| 49 | * |
||
| 50 | * @return bool |
||
| 51 | */ |
||
| 52 | 3 | public function has($name) |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @return EnumInterface[] |
||
| 59 | */ |
||
| 60 | 1 | public function all() |
|
| 64 | } |
||
| 65 |