Skip to content

Commit d509764

Browse files
committed
minor #19713 [FrameworkBundle] Remove duplicated code in RouterDebugCommand (JhonnyL)
This PR was merged into the 2.7 branch. Discussion ---------- [FrameworkBundle] Remove duplicated code in RouterDebugCommand | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 20a69aa [FrameworkBundle] Remove duplicated code in RouterDebugCommand
2 parents 321b3dd + da871d7 commit d509764

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Command/RouterDebugCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
8383

8484
$name = $input->getArgument('name');
8585
$helper = new DescriptorHelper();
86+
$routes = $this->getContainer()->get('router')->getRouteCollection();
8687

8788
if ($name) {
88-
$route = $this->getContainer()->get('router')->getRouteCollection()->get($name);
89-
if (!$route) {
89+
if (!$route = $routes->get($name)) {
9090
throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
9191
}
9292
$this->convertController($route);
@@ -96,8 +96,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
9696
'name' => $name,
9797
));
9898
} else {
99-
$routes = $this->getContainer()->get('router')->getRouteCollection();
100-
10199
foreach ($routes as $route) {
102100
$this->convertController($route);
103101
}

0 commit comments

Comments
 (0)