Skip to content

Commit da871d7

Browse files
committed
[FrameworkBundle] Remove duplicated code in RouterDebugCommand
1 parent ce506f3 commit da871d7

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)