function LazyRouteCollection::get

Gets a route by name.

Parameters

string $name: The route name

Return value

\Symfony\Component\Routing\Route|null A Route instance or null when not found

File

core/lib/Drupal/Core/Routing/LazyRouteCollection.php, line 60

Class

LazyRouteCollection

Namespace

Drupal\Core\Routing

Code

public function get($name) : ?Route {
  try {
    return $this->provider
      ->getRouteByName($name);
  } catch (RouteNotFoundException $e) {
    return NULL;
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.