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; } } }