public function DynamicRouter::match in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony-cmf/routing/DynamicRouter.php \Symfony\Cmf\Component\Routing\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
Deprecated
Use matchRequest exclusively to avoid problems. This method will be removed in version 2.0
File
- vendor/
symfony-cmf/ routing/ DynamicRouter.php, line 204
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\RoutingCode
public function match($pathinfo) {
$request = Request::create($pathinfo);
if ($this->eventDispatcher) {
$event = new RouterMatchEvent();
$this->eventDispatcher
->dispatch(Events::PRE_DYNAMIC_MATCH, $event);
}
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);
}