class LazyRouteCollection
Hierarchy
- class \Symfony\Component\Routing\RouteCollection implements \Symfony\Component\Routing\IteratorAggregate, \Symfony\Component\Routing\Countable
- class \Drupal\Core\Routing\LazyRouteCollection extends \Symfony\Component\Routing\RouteCollection
Expanded class hierarchy of LazyRouteCollection
File
-
core/
lib/ Drupal/ Core/ Routing/ LazyRouteCollection.php, line 9
Namespace
Drupal\Core\RoutingView source
class LazyRouteCollection extends RouteCollection {
/**
* The route provider for this generator.
*
* @var \Drupal\Core\Routing\RouteProviderInterface
*/
protected $provider;
/**
* Constructs a LazyRouteCollection.
*/
public function __construct(RouteProviderInterface $provider) {
$this->provider = $provider;
}
/**
* {@inheritdoc}
*/
public function getIterator() : \ArrayIterator {
return new \ArrayIterator($this->all());
}
/**
* Gets the number of Routes in this collection.
*
* @return int
* The number of routes
*/
public function count() : int {
return count($this->all());
}
/**
* Returns all routes in this collection.
*
* @return \Symfony\Component\Routing\Route[]
* An array of routes
*/
public function all() : array {
return $this->provider
->getRoutesByNames(NULL);
}
/**
* Gets a route by name.
*
* @param string $name
* The route name
*
* @return \Symfony\Component\Routing\Route|null
* A Route instance or null when not found
*/
public function get($name) : ?Route {
try {
return $this->provider
->getRouteByName($name);
} catch (RouteNotFoundException) {
return NULL;
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
LazyRouteCollection::$provider | protected | property | The route provider for this generator. | |
LazyRouteCollection::all | public | function | Returns all routes in this collection. | Overrides RouteCollection::all |
LazyRouteCollection::count | public | function | Gets the number of Routes in this collection. | Overrides RouteCollection::count |
LazyRouteCollection::get | public | function | Gets a route by name. | Overrides RouteCollection::get |
LazyRouteCollection::getIterator | public | function | Gets the current RouteCollection as an Iterator that includes all routes. | Overrides RouteCollection::getIterator |
LazyRouteCollection::__construct | public | function | Constructs a LazyRouteCollection. | |
RouteCollection::$aliases | private | property | ||
RouteCollection::$priorities | private | property | ||
RouteCollection::$resources | private | property | ||
RouteCollection::$routes | private | property | ||
RouteCollection::add | public | function | ||
RouteCollection::addAlias | public | function | Sets an alias for an existing route. | |
RouteCollection::addCollection | public | function | Adds a route collection at the end of the current set by appending all routes of the added collection. |
|
RouteCollection::addDefaults | public | function | Adds defaults to all routes. | |
RouteCollection::addNamePrefix | public | function | Adds a prefix to the name of all the routes within in the collection. | |
RouteCollection::addOptions | public | function | Adds options to all routes. | |
RouteCollection::addPrefix | public | function | Adds a prefix to the path of all child routes. | |
RouteCollection::addRequirements | public | function | Adds requirements to all routes. | |
RouteCollection::addResource | public | function | Adds a resource for this collection. If the resource already exists it is not added. |
|
RouteCollection::getAlias | public | function | ||
RouteCollection::getAliases | public | function | ||
RouteCollection::getPriority | public | function | ||
RouteCollection::getResources | public | function | Returns an array of resources loaded to build this collection. | |
RouteCollection::remove | public | function | Removes a route or an array of routes by name from the collection. | |
RouteCollection::setCondition | public | function | Sets a condition on all routes. | |
RouteCollection::setHost | public | function | Sets the host pattern on all routes. | |
RouteCollection::setMethods | public | function | Sets the HTTP methods (e.g. 'POST') all child routes are restricted to. | |
RouteCollection::setSchemes | public | function | Sets the schemes (e.g. 'https') all child routes are restricted to. | |
RouteCollection::__clone | public | function |