Merge pull request #160 from skipperbent/v2

V2
This commit is contained in:
Simon Sessingø
2016-11-19 10:16:06 +02:00
committed by GitHub
+5 -8
View File
@@ -136,7 +136,6 @@ class RouterBase
protected function processRoutes(array $routes, array $settings = array(), array $prefixes = array(), RouterEntry $parent = null) protected function processRoutes(array $routes, array $settings = array(), array $prefixes = array(), RouterEntry $parent = null)
{ {
// Loop through each route-request // Loop through each route-request
/* @var $route RouterEntry */ /* @var $route RouterEntry */
foreach ($routes as $route) { foreach ($routes as $route) {
@@ -148,6 +147,10 @@ class RouterBase
$route->setParent($parent); $route->setParent($parent);
} }
if (count($settings)) {
$route->merge($settings);
}
if ($route instanceof RouterGroup) { if ($route instanceof RouterGroup) {
if ($route->getCallback() !== null && is_callable($route->getCallback())) { if ($route->getCallback() !== null && is_callable($route->getCallback())) {
@@ -163,15 +166,10 @@ class RouterBase
} }
} }
} }
}
if ($route instanceof RouterGroup) {
$newPrefixes[] = trim($route->getPrefix(), '/'); $newPrefixes[] = trim($route->getPrefix(), '/');
$newSettings = array_merge($settings, $route->toArray()); $newSettings = array_merge($settings, $route->toArray());
} else {
if (count($settings)) {
$route->merge($settings);
}
} }
if ($route instanceof ILoadableRoute) { if ($route instanceof ILoadableRoute) {
@@ -181,7 +179,6 @@ class RouterBase
} }
$this->controllerUrlMap[] = $route; $this->controllerUrlMap[] = $route;
} }
if (count($this->backStack) > 0) { if (count($this->backStack) > 0) {