You are here

public function ChainRouter::all in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony-cmf/routing/ChainRouter.php \Symfony\Cmf\Component\Routing\ChainRouter::all()

Sorts the routers and flattens them.

Return value

RouterInterface[] or RequestMatcherInterface and UrlGeneratorInterface.

Overrides ChainRouterInterface::all

5 calls to ChainRouter::all()
ChainRouter::doMatch in vendor/symfony-cmf/routing/ChainRouter.php
Loops through all routers and tries to match the passed request or url.
ChainRouter::generate in vendor/symfony-cmf/routing/ChainRouter.php
Loops through all registered routers and returns a router if one is found. It will always return the first route generated.
ChainRouter::getRouteCollection in vendor/symfony-cmf/routing/ChainRouter.php
Gets the RouteCollection instance associated with this Router.
ChainRouter::setContext in vendor/symfony-cmf/routing/ChainRouter.php
Sets the request context.
ChainRouter::warmUp in vendor/symfony-cmf/routing/ChainRouter.php
check for each contained router if it can warmup

File

vendor/symfony-cmf/routing/ChainRouter.php, line 98

Class

ChainRouter
The ChainRouter allows to combine several routers to try in a defined order.

Namespace

Symfony\Cmf\Component\Routing

Code

public function all() {
  if (empty($this->sortedRouters)) {
    $this->sortedRouters = $this
      ->sortRouters();

    // setContext() is done here instead of in add() to avoid fatal errors when clearing and warming up caches
    // See https://github.com/symfony-cmf/Routing/pull/18
    $context = $this
      ->getContext();
    if (null !== $context) {
      foreach ($this->sortedRouters as $router) {
        if ($router instanceof RequestContextAwareInterface) {
          $router
            ->setContext($context);
        }
      }
    }
  }
  return $this->sortedRouters;
}