From 91d9688e06db689ea314414f4b403bf9b6716770 Mon Sep 17 00:00:00 2001 From: physcocode Date: Thu, 4 Feb 2021 00:30:43 +0530 Subject: [PATCH] fix: always throw exception --- src/RouterEngine.php | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/src/RouterEngine.php b/src/RouterEngine.php index 462516d..b39a14e 100644 --- a/src/RouterEngine.php +++ b/src/RouterEngine.php @@ -88,37 +88,28 @@ public function __construct(Request $request, RouteCollection $collection, $apiM */ public function route() { - try { - // Get URL and request method. - $this->request_method = strtolower($this->request->getMethod()); + // Get URL and request method. + $this->request_method = strtolower($this->request->getMethod()); - if ($this->check_manual()) { - return true; - } - - //Break URL into segments - $this->path_info = explode('/', $this->request->getPathInfo()); - if ($this->apiMode) { - array_shift($this->path_info); - } + if ($this->check_manual()) { + return true; + } + //Break URL into segments + $this->path_info = explode('/', $this->request->getPathInfo()); + if ($this->apiMode) { array_shift($this->path_info); + } - $this->getController(); - $this->method = $this->getMethod($this->controller); - $this->request->attributes->set('_controller', $this->controller . '::' . $this->method); + array_shift($this->path_info); - $this->setArguments(); - return true; - } catch (\Exception $e) { + $this->getController(); + $this->method = $this->getMethod($this->controller); + $this->request->attributes->set('_controller', $this->controller . '::' . $this->method); - if ($this->apiMode) { - return false; - } else { - throw $e; - } - } + $this->setArguments(); + return true; }