From 6ae85398db73a6d4492013a097d5e5962776b9b7 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 1 Jan 2015 20:43:07 +0000 Subject: [PATCH] Just making silly mistakes now... --- src/pjdietz/WellRESTed/Router.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pjdietz/WellRESTed/Router.php b/src/pjdietz/WellRESTed/Router.php index a30c551..f4a9993 100644 --- a/src/pjdietz/WellRESTed/Router.php +++ b/src/pjdietz/WellRESTed/Router.php @@ -35,6 +35,14 @@ class Router implements HandlerInterface $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) { $response = null; @@ -60,7 +68,7 @@ class Router implements HandlerInterface $path = $request->getPath(); if (array_key_exists($path, $this->routes)) { $handler = new $this->routes[$path](); - $response = tryResponse($handler, $request, $args); + $response = $this->tryResponse($handler, $request, $args); } else { foreach ($this->routes as $path => $route) { // Only take elements that are not $path => $handler mapped.