@@ -39,7 +39,8 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | public function getGroup(string $name): RouteGroupInterface |
| 41 | 41 | { |
| 42 | - if (!isset($this->groups[$name])) { |
|
| 42 | + if (!isset($this->groups[$name])) |
|
| 43 | + { |
|
| 43 | 44 | $this->groups[$name] = $this->factory->make(RouteGroup::class); |
| 44 | 45 | } |
| 45 | 46 | |
@@ -78,7 +78,8 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function setCore($core): RouteGroupInterface |
| 80 | 80 | { |
| 81 | - if (!$core instanceof CoreInterface) { |
|
| 81 | + if (!$core instanceof CoreInterface) |
|
| 82 | + { |
|
| 82 | 83 | $core = $this->container->get($core); |
| 83 | 84 | } |
| 84 | 85 | $this->core = $core; |
@@ -95,7 +96,8 @@ discard block |
||
| 95 | 96 | */ |
| 96 | 97 | public function addMiddleware($middleware): RouteGroupInterface |
| 97 | 98 | { |
| 98 | - if (!$middleware instanceof MiddlewareInterface) { |
|
| 99 | + if (!$middleware instanceof MiddlewareInterface) |
|
| 100 | + { |
|
| 99 | 101 | $middleware = $this->container->get($middleware); |
| 100 | 102 | } |
| 101 | 103 | |
@@ -142,10 +144,12 @@ discard block |
||
| 142 | 144 | */ |
| 143 | 145 | public function flushRoutes(): void |
| 144 | 146 | { |
| 145 | - foreach ($this->routes as $name => $schema) { |
|
| 147 | + foreach ($this->routes as $name => $schema) |
|
| 148 | + { |
|
| 146 | 149 | $route = $this->createRoute($schema['pattern'], $schema['controller'], $schema['action']); |
| 147 | 150 | |
| 148 | - if ($schema['defaults'] !== []) { |
|
| 151 | + if ($schema['defaults'] !== []) |
|
| 152 | + { |
|
| 149 | 153 | $route = $route->withDefaults($schema['defaults']); |
| 150 | 154 | } |
| 151 | 155 | |
@@ -165,7 +169,8 @@ discard block |
||
| 165 | 169 | public function createRoute(string $pattern, string $controller, string $action): RouteInterface |
| 166 | 170 | { |
| 167 | 171 | $target = new Action($controller, $action); |
| 168 | - if ($this->core !== null) { |
|
| 172 | + if ($this->core !== null) |
|
| 173 | + { |
|
| 169 | 174 | $target = $target->withCore($this->core); |
| 170 | 175 | } |
| 171 | 176 | |