public function Router::getMatcher in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/routing/Router.php \Symfony\Component\Routing\Router::getMatcher()
Gets the UrlMatcher instance associated with this Router.
Return value
UrlMatcherInterface A UrlMatcherInterface instance
1 call to Router::getMatcher()
- Router::matchRequest in vendor/
symfony/ routing/ Router.php - Tries to match a request with a set of routes.
File
- vendor/
symfony/ routing/ Router.php, line 264
Class
- Router
- The Router class is an example of the integration of all pieces of the routing system for easier use.
Namespace
Symfony\Component\RoutingCode
public function getMatcher() {
if (null !== $this->matcher) {
return $this->matcher;
}
if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) {
$this->matcher = new $this->options['matcher_class']($this
->getRouteCollection(), $this->context);
if (method_exists($this->matcher, 'addExpressionLanguageProvider')) {
foreach ($this->expressionLanguageProviders as $provider) {
$this->matcher
->addExpressionLanguageProvider($provider);
}
}
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();
if (method_exists($dumper, 'addExpressionLanguageProvider')) {
foreach ($expressionLanguageProviders as $provider) {
$dumper
->addExpressionLanguageProvider($provider);
}
}
$options = array(
'class' => $class,
'base_class' => $baseClass,
);
$cache
->write($dumper
->dump($options), $that
->getRouteCollection()
->getResources());
});
require_once $cache
->getPath();
return $this->matcher = new $class($this->context);
}