Symfony\Component\Routing\Router::getRouteCollection PHP Method

getRouteCollection() public method

Gets the RouteCollection instance associated with this Router.
public getRouteCollection ( ) : RouteCollection
return RouteCollection A RouteCollection instance
    public function getRouteCollection()
    {
        if (null === $this->collection) {
            $this->collection = $this->loader->load($this->resource, $this->options['resource_type']);
        }

        return $this->collection;
    }

Usage Example

 /**
  * @param Router $router
  * @param $badges
  * @param string $packagist_route
  */
 public function __construct(Router $router, array $badges, array $allInBadges, $packagist_route = 'pugx_badge_packagist')
 {
     $this->router = $router;
     $this->badges = $badges;
     $this->allInBadges = $allInBadges;
     $this->packagistRoute = $packagist_route;
     $this->routes = $this->router->getRouteCollection();
 }
All Usage Examples Of Symfony\Component\Routing\Router::getRouteCollection