You are here

private function PhpMatcherDumper::buildPrefixTree in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php \Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper::buildPrefixTree()

Organizes the routes into a prefix tree.

Routes order is preserved such that traversing the tree will traverse the routes in the origin order.

Parameters

DumperCollection $collection A collection of routes:

Return value

DumperPrefixCollection

1 call to PhpMatcherDumper::buildPrefixTree()
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 384

Class

PhpMatcherDumper
PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes.

Namespace

Symfony\Component\Routing\Matcher\Dumper

Code

private function buildPrefixTree(DumperCollection $collection) {
  $tree = new DumperPrefixCollection();
  $current = $tree;
  foreach ($collection as $route) {
    $current = $current
      ->addPrefixRoute($route);
  }
  $tree
    ->mergeSlashNodes();
  return $tree;
}