Symfony\Component\Routing\RouteCollection::removeRecursively PHP Method

removeRecursively() private method

Removes a route by name from this collection and its children recursively.
private removeRecursively ( string $name ) : boolean
$name string The route name
return boolean true when found
    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;
    }