Creates the final RouteCollection and returns it.

@return RouteCollection
2921
public function build()
    {
        $routeCollection = new RouteCollection();

        foreach ($this->routes as $name => $route) {
            if ($route instanceof Route) {
                $route->setDefaults(array_merge($this->defaults, $route->getDefaults()));
                $route->setOptions(array_merge($this->options, $route->getOptions()));

                foreach ($this->requirements as $key => $val) {
                    if (!$route->hasRequirement($key)) {
                        $route->setRequirement($key, $val);
                    }
                }

                if (null !== $this->prefix) {
                    $route->setPath('/'.$this->prefix.$route->getPath());
                }

                if (!$route->getHost()) {
                    $route->setHost($this->host);
                }

                if (!$route->getCondition()) {
                    $route->setCondition($this->condition);
                }

                if (!$route->getSchemes()) {
                    $route->setSchemes($this->schemes);
                }

                if (!$route->getMethods()) {
                    $route->setMethods($this->methods);
                }

                // auto-generate the route name if it's been marked
                if ('_unnamed_route_' === substr($name, 0, 15)) {
                    $name = $this->generateRouteName($route);
                }

                $routeCollection->add($name, $route);
            } else {
                /* @var self $route */
                $subCollection = $route->build();
                $subCollection->addPrefix($this->prefix);

                $routeCollection->addCollection($subCollection);
            }
        }

        foreach ($this->resources as $resource) {
            $routeCollection->addResource($resource);
        }

        return $routeCollection;
    }
520692
protected function createRouteCollections(array $versions)
    {
        foreach ($versions as $version) {
            if (! isset($this->routes[$version])) {
                $this->routes[$version] = new RouteCollection;
            }
        }
    }
144245
public function collection($namespace)
    {
        if (!class_exists($namespace)) {
            throw new InvalidRouterCollectionException('Route Collection Class $namespace doesn\'t exists');
        }

        $routeCollection = $this->getContainer()->make($namespace);

        return $routeCollection->setRouter($this);
    }
1186902
private function &getCollection()
    {
        if (null === $this->collection) {
            $qb = $this->createAndFilterQueryBuilder($this->getEntityAlias());
            if ($this->isHydrationDisabled()) {
                $this->collection = $qb->getQuery()->getScalarResult();
            } else {
                $this->collection = $qb->getQuery()->getResult();
            }
        }
        return $this->collection;
    }
1171947
public function getCollection() {
		$collectionName = $this->collectionName;
		if(empty($collectionName)){
			return NULL;
			}
		$collection = $collectionName::getInstance();
		return $collection;
	}
756389
public function detectRoutes()
    {
        $components = $this->detectUiComponents();

        $return = [];
        foreach ($components as $component) {
            $name      = $this->files->name($component);
            $namespace = $this->resolveUIComponentNamespace($this->files->get($component));
            $return[]  = $namespace . '\\' . $name;
        }
        return new Collection($return);
    }
371252
public function create(): ResourceNameCollection
    {
        $classes = [];
        if ($this->decorated) {
            foreach ($this->decorated->create() as $resourceClass) {
                $classes[$resourceClass] = true;
            }
        }

        foreach ($this->extractor->getResources() as $resourceClass => $resource) {
            $classes[$resourceClass] = true;
        }

        return new ResourceNameCollection(array_keys($classes));
    }
280230
private function findLastRoute()
    {
        $method = $this->lastRouteMethod;
        $index = count($this->routes[$method])-1;

        return $this->routes[$method][$index];
    }
1219996
public function actionCreate()
    {
        $collection = (new Collection([
            'model' => $this->newModel(['scenario' => 'create']),
        ]))->load();

        if ($collection->count() && $collection->save()) {
            Yii::$app->session->addFlash('success', Yii::t('hipanel:dns', '{0, plural, one{DNS record} other{# DNS records}} created successfully', $collection->count()));

            return $this->renderZoneView($collection->first->hdomain_id);
        } elseif ($id = $collection->first->hdomain_id) {
            return $this->redirect(['@dns/zone/view', 'id' => $id]);
        }

        throw new BadRequestHttpException('Bad request');
    }
120657
public function getResults()
    {
        $key = $this->dataKey;
        $content = $this->content;

        if (is_object($content) && property_exists($content, $key)) {
            return new Collection($content->{$key});
        } elseif (is_array($content)) {
            return new Collection($content);
        }

        return $content;
    }
385892
public function bindRouteCollection($name = "")
    {
        $routeCollection = new RouteCollection($this->paths['app'].'/routes.yml', $this->paths, $name, $this->parser);

        return $routeCollection;
    }
220119
public static function create(?TypeCollection $types = null): self
    {
        $types = $types ?? TypeCollection::createDefault();

        $parser = new Parser();

        $factory = new RouteFactory($parser, $types);

        return new self($factory);
    }
1071982
protected function getRoutes()
    {
        if (0 === count($this->routes)) {
            return $this->router->getRouteCollection()->all();
        }

        $routes = [];
        foreach ($this->routes as $name) {
            $route = $this->router->getRouteCollection()->get($name);
            if (null !== $route) {
                $routes[$name] = $route;
            }
        }

        return $routes;
    }
532307
protected function prepareRouteCollection()
    {
        $builder = Router::createRouteBuilder('/');
        $this->app->routes($builder);
        if ($this->app instanceof PluginApplicationInterface) {
            $this->app->pluginRoutes($builder);
        }

        return Router::getRouteCollection();
    }
1259879
public function getCollection()
    {
        if (!$this->collection) {
            // gridfs
            if ($this->isFile) {
                $this->collection = $this->getConnection()->getMongoDB()->getGridFS($this->collectionName);
            // normal
            } else {
                $this->collection = $this->getConnection()->getMongoDB()->selectCollection($this->collectionName);
            }
        }

        return $this->collection;
    }
369049
protected function getControllers()
    {
        $controllers = new Collection;

        if ($controller = $this->option('use-controller')) {
            $this->addControllerIfNotExists($controllers, app($controller));

            return $controllers;
        }

        foreach ($this->router->getRoutes() as $collections) {
            foreach ($collections as $route) {
                if ($controller = $route->getControllerInstance()) {
                    $this->addControllerIfNotExists($controllers, $controller);
                }
            }
        }

        return $controllers;
    }
1259093
protected function addPluginsRoutesCollection()
    {
        $routes = new RouteCollection();

        foreach ($this->plugins as $plugin) {
            if (!$plugin->exists()) {
                throw PluginNotFoundException::createPluginRouteNotFound($plugin);
            }

            $routes->addCollection(
                $this->addPluginRoutesCollection($plugin)
            );
        }

        return $routes;
    }