Made sure not to iterate over StaticRoutes again because the key they map to is a specific child Handler

This commit is contained in:
Phil 2015-01-01 20:17:48 +00:00
parent 3aca197d7a
commit bb052625af
1 changed files with 12 additions and 9 deletions

View File

@ -49,7 +49,9 @@ class Router implements HandlerInterface
$handler = new $this->routes[$path]();
$response = $handler->getResponse($request, $args);
} else {
foreach ($this->routes as $route) {
foreach ($this->routes as $path => $route) {
// Only take elements that are not $path => $handler mapped.
if (is_int($path)) {
/** @var HandlerInterface $route */
try {
$response = $route->getResponse($request, $args);
@ -61,6 +63,7 @@ class Router implements HandlerInterface
if ($response) break;
}
}
}
if ($response) {
// Check if the router has an error handler for this status code.
$status = $response->getStatusCode();