8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db9a8c1 commit c67cf8bCopy full SHA for c67cf8b
src/Symfony/Component/Routing/RouteCollection.php
@@ -95,7 +95,12 @@ public function getIterator()
95
*/
96
public function count()
97
{
98
- return count($this->routes->all());
+ $count = 0;
99
+ foreach ($this->routes as $route) {
100
+ $count += $route instanceof RouteCollection ? count($route) : 1;
101
+ }
102
+
103
+ return $count;
104
}
105
106
/**
src/Symfony/Component/Routing/Tests/RouteCollectionTest.php
@@ -83,7 +83,7 @@ public function testCount()
83
84
$collection1 = new RouteCollection();
85
$collection->addCollection($collection1);
86
- $collection1->add('foo', new Route('/foo1'));
+ $collection1->add('foo1', new Route('/foo1'));
87
88
$this->assertCount(2, $collection);
89
0 commit comments