3 namespace Drupal\Core\Routing;
5 use Drupal\Core\Path\CurrentPathStack;
6 use Symfony\Component\HttpFoundation\Request;
7 use Symfony\Component\Routing\RouteCollection;
8 use Symfony\Cmf\Component\Routing\NestedMatcher\UrlMatcher as BaseUrlMatcher;
11 * Drupal-specific URL Matcher; handles the Drupal "system path" mapping.
13 class UrlMatcher extends BaseUrlMatcher {
18 * @var \Drupal\Core\Path\CurrentPathStack
20 protected $currentPath;
23 * Constructs a new UrlMatcher.
25 * The parent class has a constructor we need to skip, so just override it
28 * @param \Drupal\Core\Path\CurrentPathStack $current_path
31 public function __construct(CurrentPathStack $current_path) {
32 $this->currentPath = $current_path;
35 public function finalMatch(RouteCollection $collection, Request $request) {
36 $this->routes = $collection;
37 $context = new RequestContext();
38 $context->fromRequest($request);
39 $this->setContext($context);
41 return $this->match($this->currentPath->getPath($request));