Made sure not to iterate over StaticRoutes again because the key they map to is a specific child Handler
This commit is contained in:
parent
3aca197d7a
commit
bb052625af
|
|
@ -49,16 +49,19 @@ class Router implements HandlerInterface
|
||||||
$handler = new $this->routes[$path]();
|
$handler = new $this->routes[$path]();
|
||||||
$response = $handler->getResponse($request, $args);
|
$response = $handler->getResponse($request, $args);
|
||||||
} else {
|
} else {
|
||||||
foreach ($this->routes as $route) {
|
foreach ($this->routes as $path => $route) {
|
||||||
/** @var HandlerInterface $route */
|
// Only take elements that are not $path => $handler mapped.
|
||||||
try {
|
if (is_int($path)) {
|
||||||
$response = $route->getResponse($request, $args);
|
/** @var HandlerInterface $route */
|
||||||
} catch (HttpException $e) {
|
try {
|
||||||
$response = new Response();
|
$response = $route->getResponse($request, $args);
|
||||||
$response->setStatusCode($e->getCode());
|
} catch (HttpException $e) {
|
||||||
$response->setBody($e->getMessage());
|
$response = new Response();
|
||||||
|
$response->setStatusCode($e->getCode());
|
||||||
|
$response->setBody($e->getMessage());
|
||||||
|
}
|
||||||
|
if ($response) break;
|
||||||
}
|
}
|
||||||
if ($response) break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($response) {
|
if ($response) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue