浏览代码

Add $keysCount & minor CS fix

Lee McDermott 14 年之前
父节点
当前提交
5a986bfc27
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php

+ 5 - 2
src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php

@@ -75,6 +75,7 @@ EOF;
         
         $routeIterator = $routes->getIterator();
         $keys = array_keys($routeIterator->getArrayCopy());
+        $keysCount = count($keys);
         
         $i = 0;
         
@@ -86,8 +87,10 @@ EOF;
                 $optimizable = $prefix && count($route->all()) > 1 && false === strpos($route->getPrefix(), '{');
                 $indent = '';
                 if ($optimizable) {
-                    for ($j = $i; $j < count($keys); $j++) {
-                        if ($keys[$j] === null) continue;
+                    for ($j = $i; $j < $keysCount; $j++) {
+                        if ($keys[$j] === null) {
+                          continue;
+                        }
                       
                         $testRoute = $routeIterator->offsetGet($keys[$j]);
                         $isCollection = ($testRoute instanceof RouteCollection);