| Total Complexity | 6 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class GroupRegistry implements \IteratorAggregate |
||
| 13 | { |
||
| 14 | private string $defaultGroup = 'web'; |
||
| 15 | |||
| 16 | /** @var array<non-empty-string, RouteGroup> */ |
||
|
|
|||
| 17 | private array $groups = []; |
||
| 18 | |||
| 19 | 276 | public function __construct( |
|
| 20 | private readonly FactoryInterface $factory |
||
| 21 | ) { |
||
| 22 | } |
||
| 23 | |||
| 24 | 276 | public function getGroup(string $name): RouteGroup |
|
| 25 | { |
||
| 26 | 276 | if (!isset($this->groups[$name])) { |
|
| 27 | 276 | $this->groups[$name] = $this->factory->make(RouteGroup::class, ['name' => $name]); |
|
| 28 | } |
||
| 29 | |||
| 30 | 276 | return $this->groups[$name]; |
|
| 31 | } |
||
| 32 | |||
| 33 | 1 | public function setDefaultGroup(string $group): self |
|
| 38 | } |
||
| 39 | |||
| 40 | 275 | public function getDefaultGroup(): string |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return \ArrayIterator<array-key, RouteGroup> |
||
| 47 | */ |
||
| 48 | 3 | public function getIterator(): \Traversable |
|
| 51 | } |
||
| 52 | } |
||
| 53 |