annotate core/lib/Drupal/Core/Routing/UrlMatcher.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Routing;
Chris@0 4
Chris@0 5 use Drupal\Core\Path\CurrentPathStack;
Chris@0 6 use Symfony\Component\HttpFoundation\Request;
Chris@0 7 use Symfony\Component\Routing\RouteCollection;
Chris@0 8 use Symfony\Cmf\Component\Routing\NestedMatcher\UrlMatcher as BaseUrlMatcher;
Chris@0 9
Chris@0 10 /**
Chris@0 11 * Drupal-specific URL Matcher; handles the Drupal "system path" mapping.
Chris@0 12 */
Chris@0 13 class UrlMatcher extends BaseUrlMatcher {
Chris@0 14
Chris@0 15 /**
Chris@0 16 * The current path.
Chris@0 17 *
Chris@0 18 * @var \Drupal\Core\Path\CurrentPathStack
Chris@0 19 */
Chris@0 20 protected $currentPath;
Chris@0 21
Chris@0 22 /**
Chris@0 23 * Constructs a new UrlMatcher.
Chris@0 24 *
Chris@0 25 * The parent class has a constructor we need to skip, so just override it
Chris@0 26 * with a no-op.
Chris@0 27 *
Chris@0 28 * @param \Drupal\Core\Path\CurrentPathStack $current_path
Chris@0 29 * The current path.
Chris@0 30 */
Chris@0 31 public function __construct(CurrentPathStack $current_path) {
Chris@0 32 $this->currentPath = $current_path;
Chris@0 33 }
Chris@0 34
Chris@0 35 public function finalMatch(RouteCollection $collection, Request $request) {
Chris@0 36 $this->routes = $collection;
Chris@0 37 $context = new RequestContext();
Chris@0 38 $context->fromRequest($request);
Chris@0 39 $this->setContext($context);
Chris@0 40
Chris@0 41 return $this->match($this->currentPath->getPath($request));
Chris@0 42 }
Chris@0 43
Chris@0 44 }