You are here

class LazyRouteCollection in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony-cmf/routing/LazyRouteCollection.php \Symfony\Cmf\Component\Routing\LazyRouteCollection

Hierarchy

  • class \Symfony\Component\Routing\RouteCollection implements \Symfony\Component\Routing\IteratorAggregate, \Symfony\Component\Routing\Countable

Expanded class hierarchy of LazyRouteCollection

File

vendor/symfony-cmf/routing/LazyRouteCollection.php, line 18

Namespace

Symfony\Cmf\Component\Routing
View source
class LazyRouteCollection extends RouteCollection {

  /**
   * The route provider for this generator.
   *
   * @var RouteProviderInterface
   */
  protected $provider;
  public function __construct(RouteProviderInterface $provider) {
    $this->provider = $provider;
  }

  /**
   * {@inheritdoc}
   */
  public function getIterator() {
    return new \ArrayIterator($this
      ->all());
  }

  /**
   * Gets the number of Routes in this collection.
   *
   * @return int The number of routes
   */
  public function count() {
    return count($this
      ->all());
  }

  /**
   * Returns all routes in this collection.
   *
   * @return Route[] An array of routes
   */
  public function all() {
    return $this->provider
      ->getRoutesByNames(null);
  }

  /**
   * Gets a route by name.
   *
   * @param string $name The route name
   *
   * @return Route|null A Route instance or null when not found
   */
  public function get($name) {
    try {
      return $this->provider
        ->getRouteByName($name);
    } catch (RouteNotFoundException $e) {
      return null;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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
RouteCollection::$resources private property
RouteCollection::$routes private property
RouteCollection::add public function Adds a route. 1
RouteCollection::addCollection public function Adds a route collection at the end of the current set by appending all routes of the added collection. 1
RouteCollection::addDefaults public function Adds defaults to all routes. 1
RouteCollection::addOptions public function Adds options to all routes. 1
RouteCollection::addPrefix public function Adds a prefix to the path of all child routes. 1
RouteCollection::addRequirements public function Adds requirements to all routes. 1
RouteCollection::addResource public function Adds a resource for this collection. 1
RouteCollection::getResources public function Returns an array of resources loaded to build this collection. 1
RouteCollection::remove public function Removes a route or an array of routes by name from the collection. 1
RouteCollection::setCondition public function Sets a condition on all routes.
RouteCollection::setHost public function Sets the host pattern on all routes. 1
RouteCollection::setMethods public function Sets the HTTP methods (e.g. 'POST') all child routes are restricted to. 1
RouteCollection::setSchemes public function Sets the schemes (e.g. 'https') all child routes are restricted to. 1
RouteCollection::__clone public function 1