Merge pull request #29 from skipperbent/development

[BUGFIX] Group will now always be rendered no matter of what prefix is.
This commit is contained in:
Simon Sessingø
2015-11-17 00:56:28 +01:00
+11 -18
View File
@@ -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) {