Esempio n. 1
0
 /**
  * Organizes the routes into a prefix tree.
  *
  * Routes order is preserved such that traversing the tree will traverse the
  * routes in the origin order.
  *
  * @param DumperCollection $collection A collection of routes
  *
  * @return DumperPrefixCollection
  */
 private function buildPrefixTree(DumperCollection $collection)
 {
     $tree = new DumperPrefixCollection();
     $current = $tree;
     foreach ($collection as $route) {
         $current = $current->addPrefixRoute($route);
     }
     $tree->mergeSlashNodes();
     return $tree;
 }