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
This commit is contained in:
Fabien Potencier 2016-08-23 10:14:32 -07:00
commit d30c3184df
1 changed files with 2 additions and 4 deletions

View File

@ -83,10 +83,10 @@ EOF
$name = $input->getArgument('name');
$helper = new DescriptorHelper();
$routes = $this->getContainer()->get('router')->getRouteCollection();
if ($name) {
$route = $this->getContainer()->get('router')->getRouteCollection()->get($name);
if (!$route) {
if (!$route = $routes->get($name)) {
throw new \InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
}
$this->convertController($route);
@ -96,8 +96,6 @@ EOF
'name' => $name,
));
} else {
$routes = $this->getContainer()->get('router')->getRouteCollection();
foreach ($routes as $route) {
$this->convertController($route);
}