From 20a69aa1cf2a547274cd0ae3fca8112f730ec3d2 Mon Sep 17 00:00:00 2001 From: JhonnyL Date: Tue, 23 Aug 2016 14:39:28 +0200 Subject: [PATCH] [FrameworkBundle] Remove duplicated code in RouterDebugCommand --- .../Bundle/FrameworkBundle/Command/RouterDebugCommand.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php index 8c29492040..eb4407b8f8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php @@ -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); }