@@ -51,8 +51,8 @@ protected function configure()
51
51
->setName ('router:match ' )
52
52
->setDefinition (array (
53
53
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 ' ),
56
56
))
57
57
->setDescription ('Helps debug routes by simulating a path info match ' )
58
58
->setHelp (<<<EOF
@@ -74,8 +74,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
74
74
{
75
75
$ router = $ this ->getContainer ()->get ('router ' );
76
76
$ 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
+ }
79
83
80
84
$ matcher = new TraceableUrlMatcher ($ router ->getRouteCollection (), $ context );
81
85
0 commit comments