@@ -103,9 +103,9 @@ |
||
| 103 | 103 | $this->assertSame('echoed', (string)$response->getBody()); |
| 104 | 104 | |
| 105 | 105 | $e = null; |
| 106 | - try { |
|
| 106 | + try{ |
|
| 107 | 107 | $router->handle(new ServerRequest([], [], new Uri('/test'))); |
| 108 | - } catch (UndefinedRouteException $e) { |
|
| 108 | + }catch (UndefinedRouteException $e){ |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $this->assertNotNull($e, 'Autofill not fired'); |
@@ -103,9 +103,12 @@ |
||
| 103 | 103 | $this->assertSame('echoed', (string)$response->getBody()); |
| 104 | 104 | |
| 105 | 105 | $e = null; |
| 106 | - try { |
|
| 106 | + try |
|
| 107 | + { |
|
| 107 | 108 | $router->handle(new ServerRequest([], [], new Uri('/test'))); |
| 108 | - } catch (UndefinedRouteException $e) { |
|
| 109 | + } |
|
| 110 | + catch (UndefinedRouteException $e) |
|
| 111 | + { |
|
| 109 | 112 | } |
| 110 | 113 | |
| 111 | 114 | $this->assertNotNull($e, 'Autofill not fired'); |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $response = new Response('php://memory', $code, []); |
| 38 | 38 | $response = $response->withStatus($code, $reasonPhrase); |
| 39 | 39 | |
| 40 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
| 40 | + foreach ($this->config->getBaseHeaders() as $header => $value){ |
|
| 41 | 41 | $response = $response->withAddedHeader($header, $value); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -37,7 +37,8 @@ |
||
| 37 | 37 | $response = new Response('php://memory', $code, []); |
| 38 | 38 | $response = $response->withStatus($code, $reasonPhrase); |
| 39 | 39 | |
| 40 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
| 40 | + foreach ($this->config->getBaseHeaders() as $header => $value) |
|
| 41 | + { |
|
| 41 | 42 | $response = $response->withAddedHeader($header, $value); |
| 42 | 43 | } |
| 43 | 44 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | string $clientFilename = null, |
| 27 | 27 | string $clientMediaType = null |
| 28 | 28 | ): UploadedFileInterface { |
| 29 | - if ($size === null) { |
|
| 29 | + if ($size === null){ |
|
| 30 | 30 | $size = $stream->getSize(); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -26,7 +26,8 @@ |
||
| 26 | 26 | string $clientFilename = null, |
| 27 | 27 | string $clientMediaType = null |
| 28 | 28 | ): UploadedFileInterface { |
| 29 | - if ($size === null) { |
|
| 29 | + if ($size === null) |
|
| 30 | + { |
|
| 30 | 31 | $size = $stream->getSize(); |
| 31 | 32 | } |
| 32 | 33 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $router = $this->makeRouter(); |
| 28 | 28 | $router->setRoute( |
| 29 | 29 | 'action', |
| 30 | - new Route('/something', function () { |
|
| 30 | + new Route('/something', function (){ |
|
| 31 | 31 | return 'hello world'; |
| 32 | 32 | }) |
| 33 | 33 | ); |
@@ -27,7 +27,8 @@ |
||
| 27 | 27 | $router = $this->makeRouter(); |
| 28 | 28 | $router->setRoute( |
| 29 | 29 | 'action', |
| 30 | - new Route('/something', function () { |
|
| 30 | + new Route('/something', function () |
|
| 31 | + { |
|
| 31 | 32 | return 'hello world'; |
| 32 | 33 | }) |
| 33 | 34 | ); |
@@ -24,6 +24,6 @@ |
||
| 24 | 24 | |
| 25 | 25 | public function callAction(string $controller, string $action = null, array $parameters = []) |
| 26 | 26 | { |
| 27 | - return '@wrapped.' . $this->core->callAction($controller, $action, $parameters); |
|
| 27 | + return '@wrapped.'.$this->core->callAction($controller, $action, $parameters); |
|
| 28 | 28 | } |
| 29 | 29 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function __construct(string $controller, $action, int $options = 0) |
| 41 | 41 | { |
| 42 | - if (!is_string($action) && !is_array($action)) { |
|
| 42 | + if (!is_string($action) && !is_array($action)){ |
|
| 43 | 43 | throw new InvalidArgumentException( |
| 44 | 44 | sprintf( |
| 45 | 45 | 'Action parameter must type string or array, `%s` given', |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | $this->controller = $controller; |
| 52 | 52 | $this->action = $action; |
| 53 | 53 | |
| 54 | - if (is_string($action)) { |
|
| 54 | + if (is_string($action)){ |
|
| 55 | 55 | parent::__construct( |
| 56 | 56 | ['action' => $action], |
| 57 | 57 | ['action' => new Autofill($action)], |
| 58 | 58 | $options |
| 59 | 59 | ); |
| 60 | - } else { |
|
| 60 | + }else{ |
|
| 61 | 61 | parent::__construct( |
| 62 | 62 | ['action' => null], |
| 63 | 63 | ['action' => $action], |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | protected function resolveAction(array $matches): string |
| 81 | 81 | { |
| 82 | 82 | $action = $this->action; |
| 83 | - if (is_string($action)) { |
|
| 83 | + if (is_string($action)){ |
|
| 84 | 84 | return $action; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -39,7 +39,8 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function __construct(string $controller, $action, int $options = 0) |
| 41 | 41 | { |
| 42 | - if (!is_string($action) && !is_array($action)) { |
|
| 42 | + if (!is_string($action) && !is_array($action)) |
|
| 43 | + { |
|
| 43 | 44 | throw new InvalidArgumentException( |
| 44 | 45 | sprintf( |
| 45 | 46 | 'Action parameter must type string or array, `%s` given', |
@@ -51,13 +52,16 @@ discard block |
||
| 51 | 52 | $this->controller = $controller; |
| 52 | 53 | $this->action = $action; |
| 53 | 54 | |
| 54 | - if (is_string($action)) { |
|
| 55 | + if (is_string($action)) |
|
| 56 | + { |
|
| 55 | 57 | parent::__construct( |
| 56 | 58 | ['action' => $action], |
| 57 | 59 | ['action' => new Autofill($action)], |
| 58 | 60 | $options |
| 59 | 61 | ); |
| 60 | - } else { |
|
| 62 | + } |
|
| 63 | + else |
|
| 64 | + { |
|
| 61 | 65 | parent::__construct( |
| 62 | 66 | ['action' => null], |
| 63 | 67 | ['action' => $action], |
@@ -80,7 +84,8 @@ discard block |
||
| 80 | 84 | protected function resolveAction(array $matches): string |
| 81 | 85 | { |
| 82 | 86 | $action = $this->action; |
| 83 | - if (is_string($action)) { |
|
| 87 | + if (is_string($action)) |
|
| 88 | + { |
|
| 84 | 89 | return $action; |
| 85 | 90 | } |
| 86 | 91 | |
@@ -58,7 +58,8 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | protected function resolveController(array $matches): string |
| 60 | 60 | { |
| 61 | - if (preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) { |
|
| 61 | + if (preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) |
|
| 62 | + { |
|
| 62 | 63 | throw new TargetException('Invalid namespace target, controller name not allowed.'); |
| 63 | 64 | } |
| 64 | 65 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | string $namespace, |
| 34 | 34 | string $postfix = 'Controller', |
| 35 | 35 | int $options = 0 |
| 36 | - ) { |
|
| 36 | + ){ |
|
| 37 | 37 | $this->namespace = rtrim($namespace, '\\'); |
| 38 | 38 | $this->postfix = ucfirst($postfix); |
| 39 | 39 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected function resolveController(array $matches): string |
| 53 | 53 | { |
| 54 | - if (preg_match('/[^a-z_0-9\-]/i', $matches['controller'])) { |
|
| 54 | + if (preg_match('/[^a-z_0-9\-]/i', $matches['controller'])){ |
|
| 55 | 55 | throw new TargetException('Invalid namespace target, controller name not allowed.'); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -69,13 +69,17 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function handle(ServerRequestInterface $request): ResponseInterface |
| 71 | 71 | { |
| 72 | - try { |
|
| 72 | + try |
|
| 73 | + { |
|
| 73 | 74 | $route = $this->matchRoute($request, $routeName); |
| 74 | - } catch (RouteException $e) { |
|
| 75 | + } |
|
| 76 | + catch (RouteException $e) |
|
| 77 | + { |
|
| 75 | 78 | throw new RouterException('Invalid route definition', $e->getCode(), $e); |
| 76 | 79 | } |
| 77 | 80 | |
| 78 | - if ($route === null) { |
|
| 81 | + if ($route === null) |
|
| 82 | + { |
|
| 79 | 83 | throw new RouteNotFoundException($request->getUri()); |
| 80 | 84 | } |
| 81 | 85 | |
@@ -120,7 +124,8 @@ discard block |
||
| 120 | 124 | */ |
| 121 | 125 | public function getRoute(string $name): RouteInterface |
| 122 | 126 | { |
| 123 | - if (isset($this->routes[$name])) { |
|
| 127 | + if (isset($this->routes[$name])) |
|
| 128 | + { |
|
| 124 | 129 | return $this->routes[$name]; |
| 125 | 130 | } |
| 126 | 131 | |
@@ -132,7 +137,8 @@ discard block |
||
| 132 | 137 | */ |
| 133 | 138 | public function getRoutes(): array |
| 134 | 139 | { |
| 135 | - if (!empty($this->default)) { |
|
| 140 | + if (!empty($this->default)) |
|
| 141 | + { |
|
| 136 | 142 | return $this->routes + [null => $this->default]; |
| 137 | 143 | } |
| 138 | 144 | |
@@ -144,9 +150,12 @@ discard block |
||
| 144 | 150 | */ |
| 145 | 151 | public function uri(string $route, $parameters = []): UriInterface |
| 146 | 152 | { |
| 147 | - try { |
|
| 153 | + try |
|
| 154 | + { |
|
| 148 | 155 | return $this->getRoute($route)->uri($parameters); |
| 149 | - } catch (UndefinedRouteException $e) { |
|
| 156 | + } |
|
| 157 | + catch (UndefinedRouteException $e) |
|
| 158 | + { |
|
| 150 | 159 | //In some cases route name can be provided as controller:action pair, we can try to |
| 151 | 160 | //generate such route automatically based on our default/fallback route |
| 152 | 161 | return $this->castRoute($route)->uri($parameters); |
@@ -161,17 +170,20 @@ discard block |
||
| 161 | 170 | */ |
| 162 | 171 | protected function matchRoute(ServerRequestInterface $request, string &$routeName = null): ?RouteInterface |
| 163 | 172 | { |
| 164 | - foreach ($this->routes as $name => $route) { |
|
| 173 | + foreach ($this->routes as $name => $route) |
|
| 174 | + { |
|
| 165 | 175 | // Matched route will return new route instance with matched parameters |
| 166 | 176 | $matched = $route->match($request); |
| 167 | 177 | |
| 168 | - if ($matched !== null) { |
|
| 178 | + if ($matched !== null) |
|
| 179 | + { |
|
| 169 | 180 | $routeName = $name; |
| 170 | 181 | return $matched; |
| 171 | 182 | } |
| 172 | 183 | } |
| 173 | 184 | |
| 174 | - if ($this->default !== null) { |
|
| 185 | + if ($this->default !== null) |
|
| 186 | + { |
|
| 175 | 187 | return $this->default->match($request); |
| 176 | 188 | } |
| 177 | 189 | |
@@ -187,7 +199,8 @@ discard block |
||
| 187 | 199 | */ |
| 188 | 200 | protected function configure(RouteInterface $route): RouteInterface |
| 189 | 201 | { |
| 190 | - if ($route instanceof ContainerizedInterface && !$route->hasContainer()) { |
|
| 202 | + if ($route instanceof ContainerizedInterface && !$route->hasContainer()) |
|
| 203 | + { |
|
| 191 | 204 | // isolating route in a given container |
| 192 | 205 | $route = $route->withContainer($this->container); |
| 193 | 206 | } |
@@ -220,11 +233,16 @@ discard block |
||
| 220 | 233 | ); |
| 221 | 234 | } |
| 222 | 235 | |
| 223 | - if (!empty($matches['name'])) { |
|
| 236 | + if (!empty($matches['name'])) |
|
| 237 | + { |
|
| 224 | 238 | $routeObject = $this->getRoute($matches['name']); |
| 225 | - } elseif ($this->default !== null) { |
|
| 239 | + } |
|
| 240 | + elseif ($this->default !== null) |
|
| 241 | + { |
|
| 226 | 242 | $routeObject = $this->default; |
| 227 | - } else { |
|
| 243 | + } |
|
| 244 | + else |
|
| 245 | + { |
|
| 228 | 246 | throw new UndefinedRouteException("Unable to locate route candidate for `{$route}`"); |
| 229 | 247 | } |
| 230 | 248 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function __construct(string $basePath, UriHandler $uriHandler, ContainerInterface $container) |
| 53 | 53 | { |
| 54 | - $this->basePath = '/' . ltrim($basePath, '/'); |
|
| 54 | + $this->basePath = '/'.ltrim($basePath, '/'); |
|
| 55 | 55 | $this->uriHandler = $uriHandler; |
| 56 | 56 | $this->container = $container; |
| 57 | 57 | } |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function handle(ServerRequestInterface $request): ResponseInterface |
| 66 | 66 | { |
| 67 | - try { |
|
| 67 | + try{ |
|
| 68 | 68 | $route = $this->matchRoute($request, $routeName); |
| 69 | - } catch (RouteException $e) { |
|
| 69 | + }catch (RouteException $e){ |
|
| 70 | 70 | throw new RouterException('Invalid route definition', $e->getCode(), $e); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ($route === null) { |
|
| 73 | + if ($route === null){ |
|
| 74 | 74 | throw new RouteNotFoundException($request->getUri()); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function getRoute(string $name): RouteInterface |
| 117 | 117 | { |
| 118 | - if (isset($this->routes[$name])) { |
|
| 118 | + if (isset($this->routes[$name])){ |
|
| 119 | 119 | return $this->routes[$name]; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function getRoutes(): array |
| 129 | 129 | { |
| 130 | - if (!empty($this->default)) { |
|
| 130 | + if (!empty($this->default)){ |
|
| 131 | 131 | return $this->routes + [null => $this->default]; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function uri(string $route, $parameters = []): UriInterface |
| 141 | 141 | { |
| 142 | - try { |
|
| 142 | + try{ |
|
| 143 | 143 | return $this->getRoute($route)->uri($parameters); |
| 144 | - } catch (UndefinedRouteException $e) { |
|
| 144 | + }catch (UndefinedRouteException $e){ |
|
| 145 | 145 | //In some cases route name can be provided as controller:action pair, we can try to |
| 146 | 146 | //generate such route automatically based on our default/fallback route |
| 147 | 147 | return $this->castRoute($route)->uri($parameters); |
@@ -153,17 +153,17 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | protected function matchRoute(ServerRequestInterface $request, string &$routeName = null): ?RouteInterface |
| 155 | 155 | { |
| 156 | - foreach ($this->routes as $name => $route) { |
|
| 156 | + foreach ($this->routes as $name => $route){ |
|
| 157 | 157 | // Matched route will return new route instance with matched parameters |
| 158 | 158 | $matched = $route->match($request); |
| 159 | 159 | |
| 160 | - if ($matched !== null) { |
|
| 160 | + if ($matched !== null){ |
|
| 161 | 161 | $routeName = $name; |
| 162 | 162 | return $matched; |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if ($this->default !== null) { |
|
| 166 | + if ($this->default !== null){ |
|
| 167 | 167 | return $this->default->match($request); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | protected function configure(RouteInterface $route): RouteInterface |
| 178 | 178 | { |
| 179 | - if ($route instanceof ContainerizedInterface && !$route->hasContainer()) { |
|
| 179 | + if ($route instanceof ContainerizedInterface && !$route->hasContainer()){ |
|
| 180 | 180 | // isolating route in a given container |
| 181 | 181 | $route = $route->withContainer($this->container); |
| 182 | 182 | } |
@@ -201,17 +201,17 @@ discard block |
||
| 201 | 201 | $route, |
| 202 | 202 | $matches |
| 203 | 203 | ) |
| 204 | - ) { |
|
| 204 | + ){ |
|
| 205 | 205 | throw new UndefinedRouteException( |
| 206 | 206 | "Unable to locate route or use default route with 'name/controller:action' pattern" |
| 207 | 207 | ); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if (!empty($matches['name'])) { |
|
| 210 | + if (!empty($matches['name'])){ |
|
| 211 | 211 | $routeObject = $this->getRoute($matches['name']); |
| 212 | - } elseif ($this->default !== null) { |
|
| 212 | + } elseif ($this->default !== null){ |
|
| 213 | 213 | $routeObject = $this->default; |
| 214 | - } else { |
|
| 214 | + }else{ |
|
| 215 | 215 | throw new UndefinedRouteException("Unable to locate route candidate for `{$route}`"); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | $route = clone $this; |
| 47 | 47 | |
| 48 | 48 | // array fallback |
| 49 | - if (count($middleware) === 1 && is_array($middleware[0])) { |
|
| 49 | + if (count($middleware) === 1 && is_array($middleware[0])){ |
|
| 50 | 50 | $middleware = $middleware[0]; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - foreach ($middleware as $item) { |
|
| 54 | - if (!is_string($item) && !$item instanceof MiddlewareInterface) { |
|
| 55 | - if (is_object($item)) { |
|
| 53 | + foreach ($middleware as $item){ |
|
| 54 | + if (!is_string($item) && !$item instanceof MiddlewareInterface){ |
|
| 55 | + if (is_object($item)){ |
|
| 56 | 56 | $name = get_class($item); |
| 57 | - } else { |
|
| 57 | + }else{ |
|
| 58 | 58 | $name = gettype($item); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $route->middleware[] = $item; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if ($route->pipeline !== null) { |
|
| 67 | + if ($route->pipeline !== null){ |
|
| 68 | 68 | $route->pipeline = $route->makePipeline(); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -81,22 +81,22 @@ discard block |
||
| 81 | 81 | protected function makePipeline(): Pipeline |
| 82 | 82 | { |
| 83 | 83 | // pre-aggregated |
| 84 | - if (count($this->middleware) === 1 && $this->middleware[0] instanceof Pipeline) { |
|
| 84 | + if (count($this->middleware) === 1 && $this->middleware[0] instanceof Pipeline){ |
|
| 85 | 85 | return $this->middleware[0]; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - try { |
|
| 88 | + try{ |
|
| 89 | 89 | $pipeline = $this->container->get(Pipeline::class); |
| 90 | 90 | |
| 91 | - foreach ($this->middleware as $middleware) { |
|
| 92 | - if ($middleware instanceof MiddlewareInterface) { |
|
| 91 | + foreach ($this->middleware as $middleware){ |
|
| 92 | + if ($middleware instanceof MiddlewareInterface){ |
|
| 93 | 93 | $pipeline->pushMiddleware($middleware); |
| 94 | - } else { |
|
| 94 | + }else{ |
|
| 95 | 95 | // dynamically resolved |
| 96 | 96 | $pipeline->pushMiddleware($this->container->get($middleware)); |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | - } catch (ContainerExceptionInterface $e) { |
|
| 99 | + }catch (ContainerExceptionInterface $e){ |
|
| 100 | 100 | throw new RouteException($e->getMessage(), $e->getCode(), $e); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -46,15 +46,21 @@ discard block |
||
| 46 | 46 | $route = clone $this; |
| 47 | 47 | |
| 48 | 48 | // array fallback |
| 49 | - if (count($middleware) === 1 && is_array($middleware[0])) { |
|
| 49 | + if (count($middleware) === 1 && is_array($middleware[0])) |
|
| 50 | + { |
|
| 50 | 51 | $middleware = $middleware[0]; |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | - foreach ($middleware as $item) { |
|
| 54 | - if (!is_string($item) && !$item instanceof MiddlewareInterface) { |
|
| 55 | - if (is_object($item)) { |
|
| 54 | + foreach ($middleware as $item) |
|
| 55 | + { |
|
| 56 | + if (!is_string($item) && !$item instanceof MiddlewareInterface) |
|
| 57 | + { |
|
| 58 | + if (is_object($item)) |
|
| 59 | + { |
|
| 56 | 60 | $name = get_class($item); |
| 57 | - } else { |
|
| 61 | + } |
|
| 62 | + else |
|
| 63 | + { |
|
| 58 | 64 | $name = gettype($item); |
| 59 | 65 | } |
| 60 | 66 | |
@@ -64,7 +70,8 @@ discard block |
||
| 64 | 70 | $route->middleware[] = $item; |
| 65 | 71 | } |
| 66 | 72 | |
| 67 | - if ($route->pipeline !== null) { |
|
| 73 | + if ($route->pipeline !== null) |
|
| 74 | + { |
|
| 68 | 75 | $route->pipeline = $route->makePipeline(); |
| 69 | 76 | } |
| 70 | 77 | |
@@ -81,22 +88,30 @@ discard block |
||
| 81 | 88 | protected function makePipeline(): Pipeline |
| 82 | 89 | { |
| 83 | 90 | // pre-aggregated |
| 84 | - if (count($this->middleware) === 1 && $this->middleware[0] instanceof Pipeline) { |
|
| 91 | + if (count($this->middleware) === 1 && $this->middleware[0] instanceof Pipeline) |
|
| 92 | + { |
|
| 85 | 93 | return $this->middleware[0]; |
| 86 | 94 | } |
| 87 | 95 | |
| 88 | - try { |
|
| 96 | + try |
|
| 97 | + { |
|
| 89 | 98 | $pipeline = $this->container->get(Pipeline::class); |
| 90 | 99 | |
| 91 | - foreach ($this->middleware as $middleware) { |
|
| 92 | - if ($middleware instanceof MiddlewareInterface) { |
|
| 100 | + foreach ($this->middleware as $middleware) |
|
| 101 | + { |
|
| 102 | + if ($middleware instanceof MiddlewareInterface) |
|
| 103 | + { |
|
| 93 | 104 | $pipeline->pushMiddleware($middleware); |
| 94 | - } else { |
|
| 105 | + } |
|
| 106 | + else |
|
| 107 | + { |
|
| 95 | 108 | // dynamically resolved |
| 96 | 109 | $pipeline->pushMiddleware($this->container->get($middleware)); |
| 97 | 110 | } |
| 98 | 111 | } |
| 99 | - } catch (ContainerExceptionInterface $e) { |
|
| 112 | + } |
|
| 113 | + catch (ContainerExceptionInterface $e) |
|
| 114 | + { |
|
| 100 | 115 | throw new RouteException($e->getMessage(), $e->getCode(), $e); |
| 101 | 116 | } |
| 102 | 117 | |