mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 18:52:15 +00:00
[BUGFIX] Bugfixes
- Made sure that urls are always presented in the correct order - Ignored RouterGroup in controllerUrlMap
This commit is contained in:
@@ -61,11 +61,13 @@ class RouterBase {
|
|||||||
}
|
}
|
||||||
$route->addSettings($mergedSettings);
|
$route->addSettings($mergedSettings);
|
||||||
|
|
||||||
if(!($route instanceof RouterGroup) && is_array($newPrefixes) && count($newPrefixes) && $backstack) {
|
if(!($route instanceof RouterGroup)) {
|
||||||
$route->setUrl( join('/', $newPrefixes) . $route->getUrl() );
|
if(is_array($newPrefixes) && count($newPrefixes) && $backstack) {
|
||||||
}
|
$route->setUrl( join('/', $newPrefixes) . $route->getUrl() );
|
||||||
|
}
|
||||||
|
|
||||||
$this->controllerUrlMap[] = $route;
|
$this->controllerUrlMap[] = $route;
|
||||||
|
}
|
||||||
|
|
||||||
$this->currentRoute = $route;
|
$this->currentRoute = $route;
|
||||||
if($route instanceof RouterGroup && is_callable($route->getCallback())) {
|
if($route instanceof RouterGroup && is_callable($route->getCallback())) {
|
||||||
@@ -88,6 +90,11 @@ class RouterBase {
|
|||||||
|
|
||||||
$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) {
|
||||||
|
return strcmp($b->getUrl(), $a->getUrl());
|
||||||
|
});
|
||||||
|
|
||||||
foreach($this->controllerUrlMap as $route) {
|
foreach($this->controllerUrlMap as $route) {
|
||||||
$routeMatch = $route->matchRoute($this->requestMethod, rtrim($this->requestUri, '/') . '/');
|
$routeMatch = $route->matchRoute($this->requestMethod, rtrim($this->requestUri, '/') . '/');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user