Skip to content

Commit e0cf244

Browse files
arnaud-lbfabpot
authored andcommitted
renamed variables - making next change more readable
1 parent 5fbcf88 commit e0cf244

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/Symfony/Component/Routing/Matcher/Dumper/DumperPrefixCollection.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,27 @@ public function setPrefix($prefix)
5555
public function addPrefixRoute(DumperRoute $route)
5656
{
5757
$prefix = $route->getRoute()->compile()->getStaticPrefix();
58+
$collection = $this;
5859

5960
// Same prefix, add to current leave
60-
if ($this->prefix === $prefix) {
61-
$this->add($route);
61+
if ($collection->prefix === $prefix) {
62+
$collection->add($route);
6263

63-
return $this;
64+
return $collection;
6465
}
6566

6667
// Prefix starts with route's prefix
67-
if ('' === $this->prefix || 0 === strpos($prefix, $this->prefix)) {
68-
$collection = new DumperPrefixCollection();
69-
$collection->setPrefix(substr($prefix, 0, strlen($this->prefix)+1));
70-
$this->add($collection);
68+
if ('' === $collection->prefix || 0 === strpos($prefix, $collection->prefix)) {
69+
$child = new DumperPrefixCollection();
70+
$child->setPrefix(substr($prefix, 0, strlen($collection->prefix)+1));
71+
$collection->add($child);
7172

72-
return $collection->addPrefixRoute($route);
73+
return $child->addPrefixRoute($route);
7374
}
7475

7576
// No match, fallback to parent (recursively)
7677

77-
if (null === $parent = $this->getParent()) {
78+
if (null === $parent = $collection->getParent()) {
7879
throw new \LogicException("The collection root must not have a prefix");
7980
}
8081

0 commit comments

Comments
 (0)