function RouteCollection::remove
Removes a route or an array of routes by name from the collection.
Parameters
string|string[] $name The route name or an array of route names:
File
-
vendor/
symfony/ routing/ RouteCollection.php, line 143
Class
- RouteCollection
- A RouteCollection represents a set of Route instances.
Namespace
Symfony\Component\RoutingCode
public function remove(string|array $name) : void {
$routes = [];
foreach ((array) $name as $n) {
if (isset($this->routes[$n])) {
$routes[] = $n;
}
unset($this->routes[$n], $this->priorities[$n], $this->aliases[$n]);
}
if (!$routes) {
return;
}
foreach ($this->aliases as $k => $alias) {
if (\in_array($alias->getId(), $routes, true)) {
unset($this->aliases[$k]);
}
}
}