Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / routing / Router.php
index a04385ead47d1ac507e8782b8d23191325e10b4d..6ac4205a598fcaf46611fb48353c90a7ebad9717 100644 (file)
@@ -288,32 +288,27 @@ class Router implements RouterInterface, RequestMatcherInterface
             return $this->matcher;
         }
 
-        $class = $this->options['matcher_cache_class'];
-        $baseClass = $this->options['matcher_base_class'];
-        $expressionLanguageProviders = $this->expressionLanguageProviders;
-        $that = $this; // required for PHP 5.3 where "$this" cannot be use()d in anonymous functions. Change in Symfony 3.0.
-
-        $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$class.'.php',
-            function (ConfigCacheInterface $cache) use ($that, $class, $baseClass, $expressionLanguageProviders) {
-                $dumper = $that->getMatcherDumperInstance();
+        $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['matcher_cache_class'].'.php',
+            function (ConfigCacheInterface $cache) {
+                $dumper = $this->getMatcherDumperInstance();
                 if (method_exists($dumper, 'addExpressionLanguageProvider')) {
-                    foreach ($expressionLanguageProviders as $provider) {
+                    foreach ($this->expressionLanguageProviders as $provider) {
                         $dumper->addExpressionLanguageProvider($provider);
                     }
                 }
 
                 $options = array(
-                    'class' => $class,
-                    'base_class' => $baseClass,
+                    'class' => $this->options['matcher_cache_class'],
+                    'base_class' => $this->options['matcher_base_class'],
                 );
 
-                $cache->write($dumper->dump($options), $that->getRouteCollection()->getResources());
+                $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
             }
         );
 
         require_once $cache->getPath();
 
-        return $this->matcher = new $class($this->context);
+        return $this->matcher = new $this->options['matcher_cache_class']($this->context);
     }
 
     /**
@@ -330,25 +325,22 @@ class Router implements RouterInterface, RequestMatcherInterface
         if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) {
             $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->logger);
         } else {
-            $class = $this->options['generator_cache_class'];
-            $baseClass = $this->options['generator_base_class'];
-            $that = $this; // required for PHP 5.3 where "$this" cannot be use()d in anonymous functions. Change in Symfony 3.0.
-            $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$class.'.php',
-                function (ConfigCacheInterface $cache) use ($that, $class, $baseClass) {
-                    $dumper = $that->getGeneratorDumperInstance();
+            $cache = $this->getConfigCacheFactory()->cache($this->options['cache_dir'].'/'.$this->options['generator_cache_class'].'.php',
+                function (ConfigCacheInterface $cache) {
+                    $dumper = $this->getGeneratorDumperInstance();
 
                     $options = array(
-                        'class' => $class,
-                        'base_class' => $baseClass,
+                        'class' => $this->options['generator_cache_class'],
+                        'base_class' => $this->options['generator_base_class'],
                     );
 
-                    $cache->write($dumper->dump($options), $that->getRouteCollection()->getResources());
+                    $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
                 }
             );
 
             require_once $cache->getPath();
 
-            $this->generator = new $class($this->context, $this->logger);
+            $this->generator = new $this->options['generator_cache_class']($this->context, $this->logger);
         }
 
         if ($this->generator instanceof ConfigurableRequirementsInterface) {
@@ -364,25 +356,17 @@ class Router implements RouterInterface, RequestMatcherInterface
     }
 
     /**
-     * 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.
-     *
-     * @internal
-     *
      * @return GeneratorDumperInterface
      */
-    public function getGeneratorDumperInstance()
+    protected function getGeneratorDumperInstance()
     {
         return new $this->options['generator_dumper_class']($this->getRouteCollection());
     }
 
     /**
-     * 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.
-     *
-     * @internal
-     *
      * @return MatcherDumperInterface
      */
-    public function getMatcherDumperInstance()
+    protected function getMatcherDumperInstance()
     {
         return new $this->options['matcher_dumper_class']($this->getRouteCollection());
     }