Merge pull request #18 from skipperbent/development

[OPTIMISATION] Optimised router handling - router will now use the or…
This commit is contained in:
Simon Sessingø
2015-10-27 14:02:57 +01:00
2 changed files with 2 additions and 10 deletions
-8
View File
@@ -100,14 +100,6 @@ class RouterBase {
// Loop through each route-request // Loop through each route-request
$this->processRoutes($this->routes); $this->processRoutes($this->routes);
// Make sure the urls is in the right order when comparing
usort($this->controllerUrlMap, function($a, $b) {
if(stripos($b->getUrl(), '{') !== false) {
return $a->getUrl();
}
return strcmp($b->getUrl(), $a->getUrl());
});
$routeNotAllowed = false; $routeNotAllowed = false;
/* @var $route RouterEntry */ /* @var $route RouterEntry */
+2 -2
View File
@@ -49,7 +49,7 @@ class RouterRoute extends RouterEntry {
// Check if url parameter count matches // Check if url parameter count matches
if(stripos($url, $routeMatch) === 0) { if(stripos($url, $routeMatch) === 0) {
$matches = true; $matches = (count(explode('/', rtrim($url, '/'))) == count(explode('/', rtrim($route, '/'))));
if($this->regexMatch) { if($this->regexMatch) {
$parameters = $this->parseParameters($url, true, $this->regexMatch); $parameters = $this->parseParameters($url, true, $this->regexMatch);
@@ -62,7 +62,7 @@ class RouterRoute extends RouterEntry {
} else { } else {
$url = explode('/', $url); $url = explode('/', $url);
$route = explode('/', $route); $route = explode('/', rtrim($route, '/'));
$parameters = array(); $parameters = array();