Sorts the routers and flattens them.
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;
}