@@ -54,19 +54,19 @@ private function setupChainRouter(array $config, ContainerBuilder $container, Lo
5454 // add the routers defined in the configuration mapping
5555 $ router = $ container ->getDefinition ('cmf_routing.router ' );
5656 foreach ($ config ['chain ' ]['routers_by_id ' ] as $ id => $ priority ) {
57- $ router ->addMethodCall ('add ' , array ( new Reference ($ id ), trim ($ priority )) );
57+ $ router ->addMethodCall ('add ' , [ new Reference ($ id ), trim ($ priority )] );
5858 }
5959 }
6060
6161 private function setupFormTypes (array $ config , ContainerBuilder $ container , LoaderInterface $ loader )
6262 {
6363 $ loader ->load ('form-type.xml ' );
6464
65- if (isset ( $ config [ 'dynamic ' ] )) {
65+ if (array_key_exists ( 'dynamic ' , $ config )) {
6666 $ routeTypeTypeDefinition = $ container ->getDefinition ('cmf_routing.route_type_form_type ' );
6767
6868 foreach (array_keys ($ config ['dynamic ' ]['controllers_by_type ' ]) as $ routeType ) {
69- $ routeTypeTypeDefinition ->addMethodCall ('addRouteType ' , array ( $ routeType) );
69+ $ routeTypeTypeDefinition ->addMethodCall ('addRouteType ' , [ $ routeType] );
7070 }
7171 }
7272 }
@@ -83,7 +83,7 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
8383 $ loader ->load ('routing-dynamic.xml ' );
8484
8585 // strip whitespace (XML support)
86- foreach (array ( 'controllers_by_type ' , 'controllers_by_class ' , 'templates_by_class ' , 'route_filters_by_id ' ) as $ option ) {
86+ foreach ([ 'controllers_by_type ' , 'controllers_by_class ' , 'templates_by_class ' , 'route_filters_by_id ' ] as $ option ) {
8787 $ config [$ option ] = array_map ('trim ' , $ config [$ option ]);
8888 }
8989
@@ -98,7 +98,7 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
9898 throw new InvalidConfigurationException ('It makes no sense to activate auto_locale_pattern when no locales are configured. ' );
9999 }
100100
101- $ this ->configureParameters ($ container , $ config , array (
101+ $ this ->configureParameters ($ container , $ config , [
102102 'generic_controller ' => 'generic_controller ' ,
103103 'controllers_by_type ' => 'controllers_by_type ' ,
104104 'controllers_by_class ' => 'controllers_by_class ' ,
@@ -108,7 +108,7 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
108108 'limit_candidates ' => 'dynamic.limit_candidates ' ,
109109 'locales ' => 'dynamic.locales ' ,
110110 'auto_locale_pattern ' => 'dynamic.auto_locale_pattern ' ,
111- ) );
111+ ] );
112112
113113 $ hasProvider = false ;
114114 $ hasContentRepository = false ;
@@ -118,7 +118,7 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
118118 }
119119
120120 if ($ config ['persistence ' ]['orm ' ]['enabled ' ]) {
121- $ this ->loadOrmProvider ($ config ['persistence ' ]['orm ' ], $ loader , $ container , $ locales , $ config ['match_implicit_locale ' ]);
121+ $ this ->loadOrmProvider ($ config ['persistence ' ]['orm ' ], $ loader , $ container , $ config ['match_implicit_locale ' ]);
122122 $ hasProvider = $ hasContentRepository = true ;
123123 }
124124
@@ -139,27 +139,27 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
139139 // content repository is optional
140140 if ($ hasContentRepository ) {
141141 $ generator = $ container ->getDefinition ('cmf_routing.generator ' );
142- $ generator ->addMethodCall ('setContentRepository ' , array ( new Reference ('cmf_routing.content_repository ' )) );
142+ $ generator ->addMethodCall ('setContentRepository ' , [ new Reference ('cmf_routing.content_repository ' )] );
143143 $ container ->getDefinition ('cmf_routing.enhancer.content_repository ' )
144- ->addTag ('dynamic_router_route_enhancer ' , array ( 'priority ' => 100 ) );
144+ ->addTag ('dynamic_router_route_enhancer ' , [ 'priority ' => 100 ] );
145145 }
146146
147147 $ dynamic = $ container ->getDefinition ('cmf_routing.dynamic_router ' );
148148
149149 // if any mappings are defined, set the respective route enhancer
150150 if (count ($ config ['controllers_by_type ' ]) > 0 ) {
151151 $ container ->getDefinition ('cmf_routing.enhancer.controllers_by_type ' )
152- ->addTag ('dynamic_router_route_enhancer ' , array ( 'priority ' => 60 ) );
152+ ->addTag ('dynamic_router_route_enhancer ' , [ 'priority ' => 60 ] );
153153 }
154154
155155 if (count ($ config ['controllers_by_class ' ]) > 0 ) {
156156 $ container ->getDefinition ('cmf_routing.enhancer.controllers_by_class ' )
157- ->addTag ('dynamic_router_route_enhancer ' , array ( 'priority ' => 50 ) );
157+ ->addTag ('dynamic_router_route_enhancer ' , [ 'priority ' => 50 ] );
158158 }
159159
160160 if (count ($ config ['templates_by_class ' ]) > 0 ) {
161161 $ container ->getDefinition ('cmf_routing.enhancer.templates_by_class ' )
162- ->addTag ('dynamic_router_route_enhancer ' , array ( 'priority ' => 40 ) );
162+ ->addTag ('dynamic_router_route_enhancer ' , [ 'priority ' => 40 ] );
163163
164164 /*
165165 * The CoreBundle prepends the controller from ContentBundle if the
@@ -174,7 +174,7 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
174174 }
175175
176176 // if the content class defines the template, we also need to make sure we use the generic controller for those routes
177- $ controllerForTemplates = array () ;
177+ $ controllerForTemplates = [] ;
178178 foreach ($ config ['templates_by_class ' ] as $ key => $ value ) {
179179 $ controllerForTemplates [$ key ] = $ config ['generic_controller ' ];
180180 }
@@ -183,31 +183,31 @@ private function setupDynamicRouter(array $config, ContainerBuilder $container,
183183 $ definition ->replaceArgument (2 , $ controllerForTemplates );
184184
185185 $ container ->getDefinition ('cmf_routing.enhancer.controller_for_templates_by_class ' )
186- ->addTag ('dynamic_router_route_enhancer ' , array ( 'priority ' => 30 ) );
186+ ->addTag ('dynamic_router_route_enhancer ' , [ 'priority ' => 30 ] );
187187 }
188188
189189 if (null !== $ config ['generic_controller ' ] && $ defaultController !== $ config ['generic_controller ' ]) {
190190 $ container ->getDefinition ('cmf_routing.enhancer.explicit_template ' )
191- ->addTag ('dynamic_router_route_enhancer ' , array ( 'priority ' => 10 ) );
191+ ->addTag ('dynamic_router_route_enhancer ' , [ 'priority ' => 10 ] );
192192 }
193193
194194 if (null !== $ defaultController ) {
195195 $ container ->getDefinition ('cmf_routing.enhancer.default_controller ' )
196- ->addTag ('dynamic_router_route_enhancer ' , array ( 'priority ' => -100 ) );
196+ ->addTag ('dynamic_router_route_enhancer ' , [ 'priority ' => -100 ] );
197197 }
198198
199199 if (count ($ config ['route_filters_by_id ' ]) > 0 ) {
200200 $ matcher = $ container ->getDefinition ('cmf_routing.nested_matcher ' );
201201
202202 foreach ($ config ['route_filters_by_id ' ] as $ id => $ priority ) {
203- $ matcher ->addMethodCall ('addRouteFilter ' , array ( new Reference ($ id ), $ priority) );
203+ $ matcher ->addMethodCall ('addRouteFilter ' , [ new Reference ($ id ), $ priority] );
204204 }
205205 }
206206
207207 $ dynamic ->replaceArgument (2 , new Reference ($ config ['url_generator ' ]));
208208 }
209209
210- private function loadPhpcrProvider ($ config , XmlFileLoader $ loader , ContainerBuilder $ container , array $ locales , $ matchImplicitLocale )
210+ private function loadPhpcrProvider (array $ config , LoaderInterface $ loader , ContainerBuilder $ container , array $ locales , $ matchImplicitLocale )
211211 {
212212 $ loader ->load ('provider-phpcr.xml ' );
213213
@@ -222,29 +222,17 @@ private function loadPhpcrProvider($config, XmlFileLoader $loader, ContainerBuil
222222 } elseif (!$ matchImplicitLocale ) {
223223 // remove all but the prefixes configuration from the service definition.
224224 $ definition = $ container ->getDefinition ('cmf_routing.phpcr_candidates_prefix ' );
225- $ definition ->setArguments (array ( $ definition ->getArgument (0 )) );
225+ $ definition ->setArguments ([ $ definition ->getArgument (0 )] );
226226 }
227227
228- if ($ config ['enable_initializer ' ]) {
229- $ this ->loadInitializer ($ config , $ loader , $ container );
228+ if (true === $ config ['enable_initializer ' ]) {
229+ $ this ->loadInitializer ($ loader , $ container );
230230 }
231231 }
232232
233- /**
234- * @param array $config
235- * @param XmlFileLoader $loader
236- * @param ContainerBuilder $container
237- */
238- private function loadInitializer ($ config , XmlFileLoader $ loader , ContainerBuilder $ container )
233+ private function loadInitializer (LoaderInterface $ loader , ContainerBuilder $ container )
239234 {
240- $ initializedBasepaths = array ();
241- if ('auto ' === $ config ['enable_initializer ' ] && empty ($ initializedBasepaths )) {
242- return ;
243- }
244-
245- if (true === $ config ['enable_initializer ' ] && empty ($ initializedBasepaths )) {
246- $ initializedBasepaths = $ container ->getParameter ($ this ->getAlias ().'.dynamic.persistence.phpcr.route_basepaths ' );
247- }
235+ $ initializedBasepaths = $ container ->getParameter ($ this ->getAlias ().'.dynamic.persistence.phpcr.route_basepaths ' );
248236
249237 $ container ->setParameter (
250238 $ this ->getAlias ().'.dynamic.persistence.phpcr.initialized_basepaths ' ,
@@ -254,7 +242,7 @@ private function loadInitializer($config, XmlFileLoader $loader, ContainerBuilde
254242 $ loader ->load ('initializer-phpcr.xml ' );
255243 }
256244
257- private function loadOrmProvider ($ config , XmlFileLoader $ loader , ContainerBuilder $ container , $ matchImplicitLocale )
245+ private function loadOrmProvider (array $ config , LoaderInterface $ loader , ContainerBuilder $ container , $ matchImplicitLocale )
258246 {
259247 $ loader ->load ('provider-orm.xml ' );
260248
@@ -269,7 +257,7 @@ private function loadOrmProvider($config, XmlFileLoader $loader, ContainerBuilde
269257
270258 if (!$ matchImplicitLocale ) {
271259 // remove the locales argument from the candidates
272- $ container ->getDefinition ('cmf_routing.orm_candidates ' )->setArguments (array () );
260+ $ container ->getDefinition ('cmf_routing.orm_candidates ' )->setArguments ([] );
273261 }
274262 }
275263
0 commit comments