class UrlMatcher in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Routing/UrlMatcher.php \Drupal\Core\Routing\UrlMatcher
- 10 core/lib/Drupal/Core/Routing/UrlMatcher.php \Drupal\Core\Routing\UrlMatcher
Drupal-specific URL Matcher; handles the Drupal "system path" mapping.
Hierarchy
- class \Drupal\Core\Routing\UrlMatcher extends \Symfony\Cmf\Component\Routing\NestedMatcher\UrlMatcher
Expanded class hierarchy of UrlMatcher
1 string reference to 'UrlMatcher'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses UrlMatcher
File
- core/
lib/ Drupal/ Core/ Routing/ UrlMatcher.php, line 13
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));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UrlMatcher:: |
protected | property | The current path. | |
UrlMatcher:: |
public | function | Matches a request against a route collection and returns exactly one result. | |
UrlMatcher:: |
public | function | Constructs a new UrlMatcher. | 1 |