function LazyRouteCollection::get

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Routing/LazyRouteCollection.php \Drupal\Core\Routing\LazyRouteCollection::get()
  2. 10 core/lib/Drupal/Core/Routing/LazyRouteCollection.php \Drupal\Core\Routing\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.