diff --git a/src/Pecee/SimpleRouter/RouterGroup.php b/src/Pecee/SimpleRouter/RouterGroup.php index 4c074f3..66600fb 100644 --- a/src/Pecee/SimpleRouter/RouterGroup.php +++ b/src/Pecee/SimpleRouter/RouterGroup.php @@ -12,28 +12,21 @@ class RouterGroup extends RouterEntry { public function renderRoute(Request $request) { // Check if request method is allowed + $hasAccess = (!$this->method); - if(trim($this->prefix) === '' || strtolower($request->getUri()) == strtolower($this->prefix) || stripos($request->getUri(), $this->prefix) === 0) { - - $hasAccess = (!$this->method); - - if($this->method) { - if(is_array($this->method)) { - $hasAccess = (in_array($request->getMethod(), $this->getRequestMethods())); - } else { - $hasAccess = strtolower($this->getRequestMethods()) == strtolower($request->getMethod()); - } + if($this->method) { + if(is_array($this->method)) { + $hasAccess = (in_array($request->getMethod(), $this->getRequestMethods())); + } else { + $hasAccess = strtolower($this->getRequestMethods()) == strtolower($request->getMethod()); } - - if(!$hasAccess) { - throw new RouterException('Method not allowed'); - } - - return parent::renderRoute($request); } - // No match here, move on... - return null; + if(!$hasAccess) { + throw new RouterException('Method not allowed'); + } + + return parent::renderRoute($request); } public function matchRoute(Request $request) {