private function RouteCollection::removeRecursively

Removes a route by name from this collection and its children recursively.

Parameters

string $name The route name:

Return value

Boolean true when found

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php, line 307

Class

RouteCollection
A RouteCollection represents a set of Route instances as a tree structure.

Namespace

Symfony\Component\Routing

Code

private function removeRecursively($name) {

  // It is ensured by the adders (->add and ->addCollection) that there can
  // only be one route per name in all connected collections. So we can stop
  // iterating recursively on the first hit.
  if (isset($this->routes[$name])) {
    unset($this->routes[$name]);
    return true;
  }
  foreach ($this->routes as $routes) {
    if ($routes instanceof RouteCollection && $routes
      ->removeRecursively($name)) {
      return true;
    }
  }
  return false;
}