You are here

public function Router::matchRequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Router.php \Symfony\Component\Routing\Router::matchRequest()

Tries to match a request with a set of routes.

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

Parameters

Request $request The request to match:

Return value

array An array of parameters

Throws

ResourceNotFoundException If no matching resource could be found

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

Overrides RequestMatcherInterface::matchRequest

File

vendor/symfony/routing/Router.php, line 248

Class

Router
The Router class is an example of the integration of all pieces of the routing system for easier use.

Namespace

Symfony\Component\Routing

Code

public function matchRequest(Request $request) {
  $matcher = $this
    ->getMatcher();
  if (!$matcher instanceof RequestMatcherInterface) {

    // fallback to the default UrlMatcherInterface
    return $matcher
      ->match($request
      ->getPathInfo());
  }
  return $matcher
    ->matchRequest($request);
}