public function DynamicRouter::match

Tries to match a URL path with a set of routes.

If the matcher can not find information, it must throw one of the exceptions documented below.

@api

Parameters

string $pathinfo The path info to be parsed (raw format, i.e. not: urldecoded)

Return value

array An array of parameters

Throws

ResourceNotFoundException If the resource could not be found

MethodNotAllowedException If the resource was found but the request method is not allowed

Overrides UrlMatcherInterface::match

1 call to DynamicRouter::match()
DynamicRouter::matchRequest in drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/DynamicRouter.php
Tries to match a request with a set of routes and returns the array of information for that route.

File

drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/DynamicRouter.php, line 168

Class

DynamicRouter
A flexible router accepting matcher and generator through injection and using the RouteEnhancer concept to generate additional data on the routes.

Namespace

Symfony\Cmf\Component\Routing

Code

public function match($pathinfo) {
  if (!empty($this->uriFilterRegexp) && !preg_match($this->uriFilterRegexp, $pathinfo)) {
    throw new ResourceNotFoundException("{$pathinfo} does not match the '{$this->uriFilterRegexp}' pattern");
  }
  $matcher = $this
    ->getMatcher();
  if (!$matcher instanceof UrlMatcherInterface) {
    throw new \InvalidArgumentException('Wrong matcher type, you need to call matchRequest');
  }
  $defaults = $matcher
    ->match($pathinfo);
  return $this
    ->applyRouteEnhancers($defaults, Request::create($pathinfo));
}