Compare commits

...

10 Commits

Author SHA1 Message Date
Simon Sessingø c93e0f2ce6 Merge pull request #29 from skipperbent/development
[BUGFIX] Group will now always be rendered no matter of what prefix is.
2015-11-17 00:56:28 +01:00
Simon Sessingø 388c027d04 [BUGFIX] Group will now always be rendered no matter of what prefix is. 2015-11-17 00:55:59 +01:00
Simon Sessingø 2c8e65f25b Merge pull request #28 from skipperbent/development
[BUGFIX] Fixed routeMatch in RouterEntry not matching routes with multiple  arguments.
2015-11-14 22:22:00 +01:00
Simon Sessingø eb93584d85 [BUGFIX] Fixed routeMatch in RouterEntry not matching routes with multiple
arguments.
2015-11-14 22:21:11 +01:00
Simon Sessingø bd5d17b6fb Merge pull request #27 from skipperbent/development
[TASK] Removed Pecee folder.
2015-11-02 08:09:43 +01:00
Simon Sessingø 7c0ac390fd [TASK] Undid changes to composer.json 2015-11-02 08:09:13 +01:00
Simon Sessingø 3fc81b6492 [TASK] Readded Pecee folder. 2015-11-02 08:08:49 +01:00
Simon Sessingø b400b86322 [TASK] Removed Pecee folder. 2015-11-02 08:06:49 +01:00
Simon Sessingø 1d338e9aa9 Merge pull request #26 from skipperbent/development
[OPTIMISATION] Fixed Group only loading middleware when initialised.
2015-11-01 10:24:51 +01:00
Simon Sessingø 889ceaa37f [OPTIMISATION] Fixed Group only loading middleware when initialised. 2015-11-01 10:24:05 +01:00
2 changed files with 12 additions and 21 deletions
+11 -20
View File
@@ -12,30 +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');
}
$this->loadMiddleware($request);
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) {
+1 -1
View File
@@ -44,7 +44,7 @@ class RouterRoute extends RouterEntry {
$route = $this->url;
$routeMatch = preg_replace('/'.self::PARAMETERS_REGEX_MATCH.'/is', '', $route);
$routeMatch = preg_replace('/\/{0,1}'.self::PARAMETERS_REGEX_MATCH.'\/{0,1}/is', '', $route);
// Check if url parameter count matches
if(stripos($url, $routeMatch) === 0) {