diff --git a/src/Pecee/SimpleRouter/RouterBase.php b/src/Pecee/SimpleRouter/RouterBase.php index be513d3..0e94242 100644 --- a/src/Pecee/SimpleRouter/RouterBase.php +++ b/src/Pecee/SimpleRouter/RouterBase.php @@ -38,13 +38,17 @@ class RouterBase { } } - protected function processRoutes(array $routes, array $settings = array(), array $prefixes = array(), $backstack = false, $group = null) { + protected function processRoutes(array $routes, array $settings = array(), array $prefixes = array(), $backStack = false, $group = null) { // Loop through each route-request $activeGroup = null; + $routesCount = count($routes); + /* @var $route RouterEntry */ - foreach($routes as $route) { + for($i = 0; $i < $routesCount; $i++) { + + $route = $routes[$i]; $route->setGroup($group); @@ -68,7 +72,7 @@ class RouterBase { $route->addSettings($settings); if(!($route instanceof RouterGroup)) { - if(is_array($newPrefixes) && count($newPrefixes) && $backstack) { + if(is_array($newPrefixes) && count($newPrefixes) && $backStack) { $route->setUrl( join('/', $newPrefixes) . $route->getUrl() ); } @@ -84,11 +88,11 @@ class RouterBase { $this->currentRoute = null; if(count($this->backstack)) { - $backstack = $this->backstack; + $backStack = $this->backstack; $this->backstack = array(); // Route any routes added to the backstack - $this->processRoutes($backstack, $mergedSettings, $newPrefixes, true, $activeGroup); + $this->processRoutes($backStack, $mergedSettings, $newPrefixes, true, $activeGroup); } } }