Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / Routing / UrlMatcher.php
1 <?php
2
3 namespace Drupal\Core\Routing;
4
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;
9
10 /**
11  * Drupal-specific URL Matcher; handles the Drupal "system path" mapping.
12  */
13 class UrlMatcher extends BaseUrlMatcher {
14
15   /**
16    * The current path.
17    *
18    * @var \Drupal\Core\Path\CurrentPathStack
19    */
20   protected $currentPath;
21
22   /**
23    * Constructs a new UrlMatcher.
24    *
25    * The parent class has a constructor we need to skip, so just override it
26    * with a no-op.
27    *
28    * @param \Drupal\Core\Path\CurrentPathStack $current_path
29    *   The current path.
30    */
31   public function __construct(CurrentPathStack $current_path) {
32     $this->currentPath = $current_path;
33   }
34
35   public function finalMatch(RouteCollection $collection, Request $request) {
36     $this->routes = $collection;
37     $context = new RequestContext();
38     $context->fromRequest($request);
39     $this->setContext($context);
40
41     return $this->match($this->currentPath->getPath($request));
42   }
43
44 }