public function RouteCollection::get

Gets a route by name defined in this collection or its children.

Parameters

string $name The route name:

Return value

Route|null A Route instance or null when not found

File

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

Class

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

Namespace

Symfony\Component\Routing

Code

public function get($name) {
  if (isset($this->routes[$name])) {
    return $this->routes[$name] instanceof RouteCollection ? null : $this->routes[$name];
  }
  foreach ($this->routes as $routes) {
    if ($routes instanceof RouteCollection && null !== ($route = $routes
      ->get($name))) {
      return $route;
    }
  }
  return null;
}