function Router::matchRequest
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Routing/Router.php \Drupal\Core\Routing\Router::matchRequest()
- 10 core/lib/Drupal/Core/Routing/Router.php \Drupal\Core\Routing\Router::matchRequest()
- 11.x core/lib/Drupal/Core/Routing/Router.php \Drupal\Core\Routing\Router::matchRequest()
1 call to Router::matchRequest()
- Router::match in core/
lib/ Drupal/ Core/ Routing/ Router.php
File
-
core/
lib/ Drupal/ Core/ Routing/ Router.php, line 109
Class
- Router
- Router implementation in Drupal.
Namespace
Drupal\Core\RoutingCode
public function matchRequest(Request $request) : array {
try {
$collection = $this->getInitialRouteCollection($request);
} catch (\TypeError $e) {
\Drupal::service('router.builder')->rebuild();
$collection = $this->getInitialRouteCollection($request);
}
if ($collection->count() === 0) {
throw new ResourceNotFoundException(sprintf('No routes found for "%s".', $this->currentPath
->getPath()));
}
$collection = $this->applyRouteFilters($collection, $request);
$collection = $this->applyFitOrder($collection);
if ($ret = $this->matchCollection(rawurldecode($this->currentPath
->getPath($request)), $collection)) {
return $this->applyRouteEnhancers($ret, $request);
}
throw 0 < count($this->allow) ? new MethodNotAllowedException(array_unique($this->allow)) : new ResourceNotFoundException(sprintf('No routes found for "%s".', $this->currentPath
->getPath()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.