class UrlMatcher
Same name in this branch
- 11.1.x vendor/symfony/routing/Matcher/UrlMatcher.php \Symfony\Component\Routing\Matcher\UrlMatcher
Drupal-specific URL Matcher; handles the Drupal "system path" mapping.
Hierarchy
- class \Symfony\Component\Routing\Matcher\UrlMatcher implements \Symfony\Component\Routing\Matcher\UrlMatcherInterface, \Symfony\Component\Routing\Matcher\RequestMatcherInterface
- class \Drupal\Core\Routing\UrlMatcher extends \Symfony\Component\Routing\Matcher\UrlMatcher
Expanded class hierarchy of UrlMatcher
File
-
core/
lib/ Drupal/ Core/ Routing/ UrlMatcher.php, line 14
Namespace
Drupal\Core\RoutingView source
class UrlMatcher extends BaseUrlMatcher {
/**
* The current path.
*
* @var \Drupal\Core\Path\CurrentPathStack
*/
protected $currentPath;
/**
* Constructs a new UrlMatcher.
*
* The parent class has a constructor we need to skip, so just override it
* with a no-op.
*
* @param \Drupal\Core\Path\CurrentPathStack $current_path
* The current path.
*/
public function __construct(CurrentPathStack $current_path) {
$this->currentPath = $current_path;
}
public function finalMatch(RouteCollection $collection, Request $request) {
$this->routes = $collection;
$context = new RequestContext();
$context->fromRequest($request);
$this->setContext($context);
return $this->match($this->currentPath
->getPath($request));
}
/**
* {@inheritdoc}
*/
protected function getAttributes(Route $route, $name, array $attributes) : array {
if ($route instanceof RouteObjectInterface && is_string($route->getRouteKey())) {
$name = $route->getRouteKey();
}
$attributes[RouteObjectInterface::ROUTE_NAME] = $name;
$attributes[RouteObjectInterface::ROUTE_OBJECT] = $route;
return $this->mergeDefaults($attributes, $route->getDefaults());
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
UrlMatcher::$allow | protected | property | Collects HTTP methods that would be allowed for the request. | ||
UrlMatcher::$allowSchemes | protected | property | Collects URI schemes that would be allowed for the request. | ||
UrlMatcher::$currentPath | protected | property | The current path. | ||
UrlMatcher::$expressionLanguage | protected | property | |||
UrlMatcher::$expressionLanguageProviders | protected | property | |||
UrlMatcher::$request | protected | property | |||
UrlMatcher::addExpressionLanguageProvider | public | function | |||
UrlMatcher::createRequest | protected | function | @internal | ||
UrlMatcher::finalMatch | public | function | |||
UrlMatcher::getAttributes | protected | function | Returns an array of values to use as request attributes. | Overrides UrlMatcher::getAttributes | |
UrlMatcher::getContext | public | function | Gets the request context. | Overrides RequestContextAwareInterface::getContext | |
UrlMatcher::getExpressionLanguage | protected | function | |||
UrlMatcher::handleRouteRequirements | protected | function | Handles specific route requirements. | ||
UrlMatcher::match | public | function | Tries to match a URL path with a set of routes. | Overrides UrlMatcherInterface::match | 2 |
UrlMatcher::matchCollection | protected | function | Tries to match a URL with a set of routes. | 2 | |
UrlMatcher::matchRequest | public | function | Tries to match a request with a set of routes. | Overrides RequestMatcherInterface::matchRequest | 1 |
UrlMatcher::mergeDefaults | protected | function | Get merged default parameters. | ||
UrlMatcher::REQUIREMENT_MATCH | public | constant | |||
UrlMatcher::REQUIREMENT_MISMATCH | public | constant | |||
UrlMatcher::ROUTE_MATCH | public | constant | |||
UrlMatcher::setContext | public | function | Sets the request context. | Overrides RequestContextAwareInterface::setContext | |
UrlMatcher::__construct | public | function | Constructs a new UrlMatcher. | Overrides UrlMatcher::__construct | 1 |