public function ChainRouter::add in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony-cmf/routing/ChainRouter.php \Symfony\Cmf\Component\Routing\ChainRouter::add()
Add a Router to the index.
Parameters
RouterInterface $router The router instance. Instead of RouterInterface, may also: be RequestMatcherInterface and UrlGeneratorInterface.
integer $priority The priority:
Overrides ChainRouterInterface::add
File
- vendor/
symfony-cmf/ routing/ ChainRouter.php, line 80
Class
- ChainRouter
- The ChainRouter allows to combine several routers to try in a defined order.
Namespace
Symfony\Cmf\Component\RoutingCode
public function add($router, $priority = 0) {
if (!$router instanceof RouterInterface && !($router instanceof RequestMatcherInterface && $router instanceof UrlGeneratorInterface)) {
throw new \InvalidArgumentException(sprintf('%s is not a valid router.', get_class($router)));
}
if (empty($this->routers[$priority])) {
$this->routers[$priority] = array();
}
$this->routers[$priority][] = $router;
$this->sortedRouters = array();
}