8000 bug #10443 [FrameworkBundle] Use DIC parameter as default host value … · symfony/symfony@120a7e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 120a7e9

Browse files
committed
bug #10443 [FrameworkBundle] Use DIC parameter as default host value if available (romainneutron)
This PR was merged into the 2.5-dev branch. Discussion ---------- [FrameworkBundle] Use DIC parameter as default host value if available | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT This follows #10439 Commits ------- 85a2fbf [FrameworkBundle] Use DIC parameter as default host value if available
2 parents b7c158a + 85a2fbf commit 120a7e9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ protected function configure()
5151
->setName('router:match')
5252
->setDefinition(array(
5353
new InputArgument('path_info', InputArgument::REQUIRED, 'A path info'),
54-
new InputOption('method', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP method', 'GET'),
55-
new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP host', 'localhost'),
54+
new InputOption('method', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP method'),
55+
new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Sets the HTTP host'),
5656
))
5757
->setDescription('Helps debug routes by simulating a path info match')
5858
->setHelp(<<<EOF
@@ -74,8 +74,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
7474
{
7575
$router = $this->getContainer()->get('router');
7676
$context = $router->getContext();
77-
$context->setMethod($input->getOption('method'));
78-
$context->setHost($input->getOption('host'));
77+
if (null !== $method = $input->getOption('method')) {
78+
$context->setMethod($method);
79+
}
80+
if (null !== $host = $input->getOption('host')) {
81+
$context->setHost($host);
82+
}
7983

8084
$matcher = new TraceableUrlMatcher($router->getRouteCollection(), $context);
8185

0 commit comments

Comments
 (0)
0