Tries to match a request with a set of routes and returns the array of information for that route.
If the matcher can not find information, it must throw one of the exceptions documented below.
Request $request The request to match:
array An array of parameters
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
public function matchRequest(Request $request) {
if (!empty($this->uriFilterRegexp) && !preg_match($this->uriFilterRegexp, $request
->getPathInfo())) {
throw new ResourceNotFoundException("{$request->getPathInfo()} does not match the '{$this->uriFilterRegexp}' pattern");
}
$matcher = $this
->getMatcher();
if ($matcher instanceof UrlMatcherInterface) {
// the match method will enhance the route $defaults
return $this
->match($request
->getPathInfo());
}
$defaults = $matcher
->matchRequest($request);
return $this
->applyRouteEnhancers($defaults, $request);
}