| Total Complexity | 6 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | final class RouteCollector implements RouteCollectorInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var Group[]|Route[] |
||
| 11 | */ |
||
| 12 | private array $items = []; |
||
| 13 | private array $middlewareDefinitions = []; |
||
| 14 | |||
| 15 | 3 | public function addRoute(Route $route): RouteCollectorInterface |
|
| 16 | { |
||
| 17 | 3 | $this->items[] = $route; |
|
| 18 | 3 | return $this; |
|
| 19 | } |
||
| 20 | |||
| 21 | 14 | public function addGroup(Group $group): RouteCollectorInterface |
|
| 25 | } |
||
| 26 | |||
| 27 | 2 | public function middleware($middlewareDefinition): RouteCollectorInterface |
|
| 28 | { |
||
| 29 | 2 | array_unshift($this->middlewareDefinitions, $middlewareDefinition); |
|
| 30 | 2 | return $this; |
|
| 31 | } |
||
| 32 | |||
| 33 | 1 | public function prependMiddleware($middlewareDefinition): RouteCollectorInterface |
|
| 34 | { |
||
| 35 | 1 | $this->middlewareDefinitions[] = $middlewareDefinition; |
|
| 36 | 1 | return $this; |
|
| 37 | } |
||
| 38 | |||
| 39 | 15 | public function getItems(): array |
|
| 42 | } |
||
| 43 | |||
| 44 | 14 | public function getMiddlewareDefinitions(): array |
|
| 47 | } |
||
| 48 | } |
||
| 49 |