Just making silly mistakes now...
This commit is contained in:
parent
b6ec262d0e
commit
6ae85398db
|
|
@ -35,6 +35,14 @@ class Router implements HandlerInterface
|
||||||
$this->errorHandlers = array();
|
$this->errorHandlers = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the getResponse method in a try-catch.
|
||||||
|
*
|
||||||
|
* @param HandlerInterface $handler The Route or Handle to try.
|
||||||
|
* @param RequestInterface $request The incoming request.
|
||||||
|
* @param array $args The array of arguments.
|
||||||
|
* @return null|Response
|
||||||
|
*/
|
||||||
private function tryResponse($handler, $request, $args)
|
private function tryResponse($handler, $request, $args)
|
||||||
{
|
{
|
||||||
$response = null;
|
$response = null;
|
||||||
|
|
@ -60,7 +68,7 @@ class Router implements HandlerInterface
|
||||||
$path = $request->getPath();
|
$path = $request->getPath();
|
||||||
if (array_key_exists($path, $this->routes)) {
|
if (array_key_exists($path, $this->routes)) {
|
||||||
$handler = new $this->routes[$path]();
|
$handler = new $this->routes[$path]();
|
||||||
$response = tryResponse($handler, $request, $args);
|
$response = $this->tryResponse($handler, $request, $args);
|
||||||
} else {
|
} else {
|
||||||
foreach ($this->routes as $path => $route) {
|
foreach ($this->routes as $path => $route) {
|
||||||
// Only take elements that are not $path => $handler mapped.
|
// Only take elements that are not $path => $handler mapped.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue