You are here

protected function Router::matchCollection in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Routing/Router.php \Drupal\Core\Routing\Router::matchCollection()
  2. 9 core/lib/Drupal/Core/Routing/Router.php \Drupal\Core\Routing\Router::matchCollection()

File

core/lib/Drupal/Core/Routing/Router.php, line 124

Class

Router
Router implementation in Drupal.

Namespace

Drupal\Core\Routing

Code

protected function matchCollection($pathinfo, RouteCollection $routes) : array {

  // Try a case-sensitive match.
  $match = $this
    ->doMatchCollection($pathinfo, $routes, TRUE);

  // Try a case-insensitive match.
  if ($match === NULL && $routes
    ->count() > 0) {
    $match = $this
      ->doMatchCollection($pathinfo, $routes, FALSE);
  }
  if ($match === NULL) {
    throw 0 < count($this->allow) ? new MethodNotAllowedException(array_unique($this->allow)) : new ResourceNotFoundException(sprintf('No routes found for "%s".', $this->currentPath
      ->getPath()));
  }
  return $match;
}