From 85a2fbf27cc92246c48383e6873c2dc034eecfbd Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Thu, 13 Mar 2014 16:16:35 +0100 Subject: [PATCH] [FrameworkBundle] Use DIC parameter as default host value if available --- .../FrameworkBundle/Command/RouterMatchCommand.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php index bb2db9c19c..69ba04af4c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php @@ -51,8 +51,8 @@ class RouterMatchCommand extends ContainerAwareCommand ->setName('router:match') ->setDefinition(array( new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'), - new InputOption('method', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP method', 'GET'), - new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP host', 'localhost'), + new InputOption('method', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP method'), + new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP host'), )) ->setDescription('Helps debug routes by simulating a path info match') ->setHelp(<<getContainer()->get('router'); $context = $router->getContext(); - $context->setMethod($input->getOption('method')); - $context->setHost($input->getOption('host')); + if (null !== $method = $input->getOption('method')) { + $context->setMethod($method); + } + if (null !== $host = $input->getOption('host')) { + $context->setHost($host); + } $matcher = new TraceableUrlMatcher($router->getRouteCollection(), $context);