public function NestedMatcher::matchRequest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony-cmf/routing/NestedMatcher/NestedMatcher.php \Symfony\Cmf\Component\Routing\NestedMatcher\NestedMatcher::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-cmf/ routing/ NestedMatcher/ NestedMatcher.php, line 139
Class
- NestedMatcher
- A more flexible approach to matching. The route collection to match against can be dynamically determined based on the request and users can inject their own filters or use a custom final matching strategy.
Namespace
Symfony\Cmf\Component\Routing\NestedMatcherCode
public function matchRequest(Request $request) {
$collection = $this->routeProvider
->getRouteCollectionForRequest($request);
if (!count($collection)) {
throw new ResourceNotFoundException();
}
// Route filters are expected to throw an exception themselves if they
// end up filtering the list down to 0.
foreach ($this
->getRouteFilters() as $filter) {
$collection = $filter
->filter($collection, $request);
}
$attributes = $this->finalMatcher
->finalMatch($collection, $request);
return $attributes;
}