From ba719cf8806b38b0b56c795c58f8f7fdd9bd309a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Sat, 19 Nov 2016 09:15:34 +0100 Subject: [PATCH] Bugfixes --- src/Pecee/SimpleRouter/RouterBase.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Pecee/SimpleRouter/RouterBase.php b/src/Pecee/SimpleRouter/RouterBase.php index fdd4e4d..7c5dc19 100644 --- a/src/Pecee/SimpleRouter/RouterBase.php +++ b/src/Pecee/SimpleRouter/RouterBase.php @@ -136,7 +136,6 @@ class RouterBase protected function processRoutes(array $routes, array $settings = array(), array $prefixes = array(), RouterEntry $parent = null) { - // Loop through each route-request /* @var $route RouterEntry */ foreach ($routes as $route) { @@ -144,10 +143,14 @@ class RouterBase $newPrefixes = $prefixes; $newSettings = $settings; - if($parent !== null) { + if ($parent !== null) { $route->setParent($parent); } + if (count($settings)) { + $route->merge($settings); + } + if ($route instanceof RouterGroup) { if ($route->getCallback() !== null && is_callable($route->getCallback())) { @@ -163,15 +166,10 @@ class RouterBase } } } - } - if ($route instanceof RouterGroup) { $newPrefixes[] = trim($route->getPrefix(), '/'); $newSettings = array_merge($settings, $route->toArray()); - } else { - if (count($settings)) { - $route->merge($settings); - } + } if ($route instanceof ILoadableRoute) { @@ -181,7 +179,6 @@ class RouterBase } $this->controllerUrlMap[] = $route; - } if (count($this->backStack) > 0) {