@@ -39,7 +39,7 @@ |
||
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 | $this->groups[$name] = $this->factory->make(RouteGroup::class); |
44 | 44 | } |
45 | 45 |
@@ -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 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | ContainerInterface $container, |
51 | 51 | RouterInterface $router, |
52 | 52 | Pipeline $pipeline |
53 | - ) { |
|
53 | + ){ |
|
54 | 54 | $this->container = $container; |
55 | 55 | $this->router = $router; |
56 | 56 | $this->pipeline = $pipeline; |
@@ -78,7 +78,7 @@ 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 | $core = $this->container->get($core); |
83 | 83 | } |
84 | 84 | $this->core = $core; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function addMiddleware($middleware): RouteGroupInterface |
97 | 97 | { |
98 | - if (!$middleware instanceof MiddlewareInterface) { |
|
98 | + if (!$middleware instanceof MiddlewareInterface){ |
|
99 | 99 | $middleware = $this->container->get($middleware); |
100 | 100 | } |
101 | 101 | |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function flushRoutes(): void |
144 | 144 | { |
145 | - foreach ($this->routes as $name => $schema) { |
|
145 | + foreach ($this->routes as $name => $schema){ |
|
146 | 146 | $route = $this->createRoute($schema['pattern'], $schema['controller'], $schema['action']); |
147 | 147 | |
148 | - if ($schema['defaults'] !== []) { |
|
148 | + if ($schema['defaults'] !== []){ |
|
149 | 149 | $route = $route->withDefaults($schema['defaults']); |
150 | 150 | } |
151 | 151 | |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | public function createRoute(string $pattern, string $controller, string $action): RouteInterface |
166 | 166 | { |
167 | 167 | $target = new Action($controller, $action); |
168 | - if ($this->core !== null) { |
|
168 | + if ($this->core !== null){ |
|
169 | 169 | $target = $target->withCore($this->core); |
170 | 170 | } |
171 | 171 | |
172 | - $route = new Route($this->prefix . $pattern, $target); |
|
172 | + $route = new Route($this->prefix.$pattern, $target); |
|
173 | 173 | |
174 | 174 | // all routes within group share the same middleware pipeline |
175 | 175 | $route = $route->withMiddleware($this->pipeline); |
@@ -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 |