Skip to content

Commit

Permalink
[FrameworkBundle] Use DIC parameter as default host value if available
Browse files Browse the repository at this point in the history
  • Loading branch information
romainneutron committed Mar 13, 2014
1 parent b7c158a commit 85a2fbf
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -51,8 +51,8 @@ protected function configure()
->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(<<<EOF
Expand All @@ -74,8 +74,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$router = $this->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);

Expand Down

0 comments on commit 85a2fbf

Please sign in to comment.