mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 00:42:16 +00:00
[BUGFIX] Bugfixes
This commit is contained in:
@@ -11,7 +11,22 @@ class RouterGroup extends RouterEntry {
|
||||
public function matchRoute($requestMethod, $url) {
|
||||
// Check if request method is allowed
|
||||
|
||||
if(count($this->method) === 0 || strtolower($this->method) == strtolower($requestMethod) || is_array($this->method) && in_array($this->method, self::$allowedRequestTypes)) {
|
||||
if(strtolower($url) == strtolower($this->prefix) || stripos($url, $this->prefix) === 0) {
|
||||
|
||||
$hasAccess = (!$this->method);
|
||||
|
||||
if($this->method) {
|
||||
if(is_array($this->method)) {
|
||||
$hasAccess = (in_array($requestMethod, $this->method));
|
||||
} else {
|
||||
$hasAccess = strtolower($this->method) == strtolower($requestMethod);
|
||||
}
|
||||
}
|
||||
|
||||
if(!$hasAccess) {
|
||||
throw new RouterException('Method not allowed');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user