private function PhpMatcherDumper::groupRoutesByHostRegex in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php \Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper::groupRoutesByHostRegex()
Groups consecutive routes having the same host regex.
The result is a collection of collections of routes having the same host regex.
Parameters
RouteCollection $routes A flat RouteCollection:
Return value
DumperCollection A collection with routes grouped by host regex in sub-collections
1 call to PhpMatcherDumper::groupRoutesByHostRegex()
- PhpMatcherDumper::compileRoutes in vendor/
symfony/ routing/ Matcher/ Dumper/ PhpMatcherDumper.php - Generates PHP code to match a RouteCollection with all its routes.
File
- vendor/
symfony/ routing/ Matcher/ Dumper/ PhpMatcherDumper.php, line 353
Class
- PhpMatcherDumper
- PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes.
Namespace
Symfony\Component\Routing\Matcher\DumperCode
private function groupRoutesByHostRegex(RouteCollection $routes) {
$groups = new DumperCollection();
$currentGroup = new DumperCollection();
$currentGroup
->setAttribute('host_regex', null);
$groups
->add($currentGroup);
foreach ($routes as $name => $route) {
$hostRegex = $route
->compile()
->getHostRegex();
if ($currentGroup
->getAttribute('host_regex') !== $hostRegex) {
$currentGroup = new DumperCollection();
$currentGroup
->setAttribute('host_regex', $hostRegex);
$groups
->add($currentGroup);
}
$currentGroup
->add(new DumperRoute($name, $route));
}
return $groups;
}