11<?php
22
3+ declare (strict_types=1 );
4+
35/*
46 * This file is part of the FOSJsRoutingBundle package.
57 *
1921use Symfony \Component \Console \Input \InputOption ;
2022use Symfony \Component \Console \Output \OutputInterface ;
2123use Symfony \Component \Routing \Route ;
22- use Symfony \Component \Routing \RouterInterface ;
2324use Symfony \Component \Routing \RouteCollection ;
25+ use Symfony \Component \Routing \RouterInterface ;
2426
2527/**
2628 * A console command for retrieving information about exposed routes.
@@ -36,20 +38,19 @@ public function __construct(private ExposedRoutesExtractorInterface $extractor,
3638 parent ::__construct ();
3739 }
3840
39-
4041 /**
4142 * {@inheritdoc}
4243 */
4344 protected function configure (): void
4445 {
4546 $ this
46- ->setDefinition (array (
47+ ->setDefinition ([
4748 new InputArgument ('name ' , InputArgument::OPTIONAL , 'A route name ' ),
4849 new InputOption ('show-controllers ' , null , InputOption::VALUE_NONE , 'Show assigned controllers in overview ' ),
4950 new InputOption ('format ' , null , InputOption::VALUE_REQUIRED , 'The output format (txt, xml, json, or md) ' , 'txt ' ),
5051 new InputOption ('raw ' , null , InputOption::VALUE_NONE , 'To output raw route(s) ' ),
51- new InputOption ('domain ' , null , InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY , 'Specify expose domain ' , array ())
52- ) )
52+ new InputOption ('domain ' , null , InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY , 'Specify expose domain ' , []),
53+ ] )
5354 ->setName ('fos:js-routing:debug ' )
5455 ->setDescription ('Displays currently exposed routes for an application ' )
5556 ->setHelp (<<<EOF
@@ -81,23 +82,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8182 }
8283
8384 $ helper = new DescriptorHelper ();
84- $ helper ->describe ($ output , $ route , array (
85- 'format ' => $ input ->getOption ('format ' ),
86- 'raw_text ' => $ input ->getOption ('raw ' ),
85+ $ helper ->describe ($ output , $ route , [
86+ 'format ' => $ input ->getOption ('format ' ),
87+ 'raw_text ' => $ input ->getOption ('raw ' ),
8788 'show_controllers ' => $ input ->getOption ('show-controllers ' ),
88- ) );
89+ ] );
8990 } else {
9091 $ helper = new DescriptorHelper ();
91- $ helper ->describe ($ output , $ this ->getRoutes ($ input ->getOption ('domain ' )), array (
92- 'format ' => $ input ->getOption ('format ' ),
93- 'raw_text ' => $ input ->getOption ('raw ' ),
92+ $ helper ->describe ($ output , $ this ->getRoutes ($ input ->getOption ('domain ' )), [
93+ 'format ' => $ input ->getOption ('format ' ),
94+ 'raw_text ' => $ input ->getOption ('raw ' ),
9495 'show_controllers ' => $ input ->getOption ('show-controllers ' ),
95- ) );
96+ ] );
9697 }
98+
9799 return 0 ;
98100 }
99101
100- protected function getRoutes ($ domain = array () ): RouteCollection
102+ protected function getRoutes ($ domain = [] ): RouteCollection
101103 {
102104 $ routes = $ this ->extractor ->getRoutes ();
103105
@@ -108,14 +110,12 @@ protected function getRoutes($domain = array()): RouteCollection
108110 $ targetRoutes = new RouteCollection ();
109111
110112 foreach ($ routes as $ name => $ route ) {
111-
112113 $ expose = $ route ->getOption ('expose ' );
113- $ expose = is_string ($ expose ) ? ($ expose === ' true ' ? 'default ' : $ expose ) : 'default ' ;
114+ $ expose = is_string ($ expose ) ? (' true ' === $ expose ? 'default ' : $ expose ) : 'default ' ;
114115
115116 if (in_array ($ expose , $ domain , true )) {
116117 $ targetRoutes ->add ($ name , $ route );
117118 }
118-
119119 }
120120
121121 return $ targetRoutes ;
0 commit comments