16
16
use Psr \Log \LoggerInterface ;
17
17
use Symfony \Component \Routing \Generator \ConfigurableRequirementsInterface ;
18
18
use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
19
+ use Symfony \Component \Routing \Generator \Dumper \GeneratorDumperInterface ;
19
20
use Symfony \Component \Routing \Matcher \UrlMatcherInterface ;
21
+ use Symfony \Component \Routing \Matcher \Dumper \MatcherDumperInterface ;
20
22
21
23
/**
22
24
* The Router class is an example of the integration of all pieces of the
@@ -233,7 +235,7 @@ public function getMatcher()
233
235
$ class = $ this ->options ['matcher_cache_class ' ];
234
236
$ cache = new ConfigCache ($ this ->options ['cache_dir ' ].'/ ' .$ class .'.php ' , $ this ->options ['debug ' ]);
235
237
if (!$ cache ->isFresh ($ class )) {
236
- $ dumper = new $ this ->options [ ' matcher_dumper_class ' ]( $ this -> getRouteCollection () );
238
+ $ dumper = $ this ->getMatcherDumperInstance ( );
237
239
238
240
$ options = array (
239
241
'class ' => $ class ,
@@ -265,7 +267,7 @@ public function getGenerator()
265
267
$ class = $ this ->options ['generator_cache_class ' ];
266
268
$ cache = new ConfigCache ($ this ->options ['cache_dir ' ].'/ ' .$ class .'.php ' , $ this ->options ['debug ' ]);
267
269
if (!$ cache ->isFresh ($ class )) {
268
- $ dumper = new $ this ->options [ ' generator_dumper_class ' ]( $ this -> getRouteCollection () );
270
+ $ dumper = $ this ->getGeneratorDumperInstance ( );
269
271
270
272
$ options = array (
271
273
'class ' => $ class ,
@@ -286,4 +288,20 @@ public function getGenerator()
286
288
287
289
return $ this ->generator ;
288
290
}
291
+
292
+ /**
293
+ * @return GeneratorDumperInterface
294
+ */
295
+ protected function getGeneratorDumperInstance ()
296
+ {
297
+ return new $ this ->options ['generator_dumper_class ' ]($ this ->getRouteCollection ());
298
+ }
299
+
300
+ /**
301
+ * @return MatcherDumperInterface
302
+ */
303
+ protected function getMatcherDumperInstance ()
304
+ {
305
+ return new $ this ->options ['matcher_dumper_class ' ]($ this ->getRouteCollection ());
306
+ }
289
307
}
0 commit comments