@@ -278,32 +278,27 @@ public function getMatcher()
278
278
return $ this ->matcher ;
279
279
}
280
280
281
- $ class = $ this ->options ['matcher_cache_class ' ];
282
- $ baseClass = $ this ->options ['matcher_base_class ' ];
283
- $ expressionLanguageProviders = $ this ->expressionLanguageProviders ;
284
- $ that = $ this ; // required for PHP 5.3 where "$this" cannot be use()d in anonymous functions. Change in Symfony 3.0.
285
-
286
- $ cache = $ this ->getConfigCacheFactory ()->cache ($ this ->options ['cache_dir ' ].'/ ' .$ class .'.php ' ,
287
- function (ConfigCacheInterface $ cache ) use ($ that , $ class , $ baseClass , $ expressionLanguageProviders ) {
288
- $ dumper = $ that ->getMatcherDumperInstance ();
281
+ $ cache = $ this ->getConfigCacheFactory ()->cache ($ this ->options ['cache_dir ' ].'/ ' .$ this ->options ['matcher_cache_class ' ].'.php ' ,
282
+ function (ConfigCacheInterface $ cache ) {
283
+ $ dumper = $ this ->getMatcherDumperInstance ();
289
284
if (method_exists ($ dumper , 'addExpressionLanguageProvider ' )) {
290
- foreach ($ expressionLanguageProviders as $ provider ) {
285
+ foreach ($ this -> expressionLanguageProviders as $ provider ) {
291
286
$ dumper ->addExpressionLanguageProvider ($ provider );
292
287
}
293
288
}
294
289
295
290
$ options = array (
296
- 'class ' => $ class ,
297
- 'base_class ' => $ baseClass ,
291
+ 'class ' => $ this -> options [ ' matcher_cache_class ' ] ,
292
+ 'base_class ' => $ this -> options [ ' matcher_base_class ' ] ,
298
293
);
299
294
300
- $ cache ->write ($ dumper ->dump ($ options ), $ that ->getRouteCollection ()->getResources ());
295
+ $ cache ->write ($ dumper ->dump ($ options ), $ this ->getRouteCollection ()->getResources ());
301
296
}
302
297
);
303
298
304
299
require_once $ cache ->getPath ();
305
300
306
- return $ this ->matcher = new $ class ($ this ->context );
301
+ return $ this ->matcher = new $ this -> options [ ' matcher_cache_class ' ] ($ this ->context );
307
302
}
308
303
309
304
/**
@@ -320,25 +315,22 @@ public function getGenerator()
320
315
if (null === $ this ->options ['cache_dir ' ] || null === $ this ->options ['generator_cache_class ' ]) {
321
316
$ this ->generator = new $ this ->options ['generator_class ' ]($ this ->getRouteCollection (), $ this ->context , $ this ->logger );
322
317
} else {
323
- $ class = $ this ->options ['generator_cache_class ' ];
324
- $ baseClass = $ this ->options ['generator_base_class ' ];
325
- $ that = $ this ; // required for PHP 5.3 where "$this" cannot be use()d in anonymous functions. Change in Symfony 3.0.
326
- $ cache = $ this ->getConfigCacheFactory ()->cache ($ this ->options ['cache_dir ' ].'/ ' .$ class .'.php ' ,
327
- function (ConfigCacheInterface $ cache ) use ($ that , $ class , $ baseClass ) {
328
- $ dumper = $ that ->getGeneratorDumperInstance ();
318
+ $ cache = $ this ->getConfigCacheFactory ()->cache ($ this ->options ['cache_dir ' ].'/ ' .$ this ->options ['generator_cache_class ' ].'.php ' ,
319
+ function (ConfigCacheInterface $ cache ) {
320
+ $ dumper = $ this ->getGeneratorDumperInstance ();
329
321
330
322
$ options = array (
331
- 'class ' => $ class ,
332
- 'base_class ' => $ baseClass ,
323
+ 'class ' => $ this -> options [ ' generator_cache_class ' ] ,
324
+ 'base_class ' => $ this -> options [ ' generator_base_class ' ] ,
333
325
);
334
326
335
- $ cache ->write ($ dumper ->dump ($ options ), $ that ->getRouteCollection ()->getResources ());
327
+ $ cache ->write ($ dumper ->dump ($ options ), $ this ->getRouteCollection ()->getResources ());
336
328
}
337
329
);
338
330
339
331
require_once $ cache ->getPath ();
340
332
341
- $ this ->generator = new $ class ($ this ->context , $ this ->logger );
333
+ $ this ->generator = new $ this -> options [ ' generator_cache_class ' ] ($ this ->context , $ this ->logger );
342
334
}
343
335
344
336
if ($ this ->generator instanceof ConfigurableRequirementsInterface) {
@@ -354,21 +346,17 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac
354
346
}
355
347
356
348
/**
357
- * This method is public because it needs to be callable from a closure in PHP 5.3. It should be converted back to protected in 3.0.
358
- * @internal
359
349
* @return GeneratorDumperInterface
360
350
*/
361
- public function getGeneratorDumperInstance ()
351
+ protected function getGeneratorDumperInstance ()
362
352
{
363
353
return new $ this ->options ['generator_dumper_class ' ]($ this ->getRouteCollection ());
364
354
}
365
355
366
356
/**
367
- * This method is public because it needs to be callable from a closure in PHP 5.3. It should be converted back to protected in 3.0.
368
- * @internal
369
357
* @return MatcherDumperInterface
370
358
*/
371
- public function getMatcherDumperInstance ()
359
+ protected function getMatcherDumperInstance ()
372
360
{
373
361
return new $ this ->options ['matcher_dumper_class ' ]($ this ->getRouteCollection ());
374
362
}
0 commit comments