Add routes

@param \FreeFW\Router\RouteCollection $p_collection

@return \FreeFW\Router\RouteCollection
439565
public function addRoutes(\FreeFW\Router\RouteCollection $p_collection)
    {
        $this->routes = array_merge($this->routes, $p_collection->getRoutes());
        return $this;
    }
710957
protected function collectionRouteList($routeName, Collection $collection, $key = 'id')
    {
        $keys = $collection->pluck($key);

        return array_map(function ($key) use ($routeName) {
            return route($routeName, $key);
        }, $keys->all());
    }
749986
public function getRoutes($version = null)
    {
        $routes = $this->adapter->getIterableRoutes($version);

        if (! is_null($version)) {
            $routes = [$version => $routes];
        }

        $collections = [];

        foreach ($routes as $key => $value) {
            $collections[$key] = new RouteCollection($this->container['request']);

            foreach ($value as $route) {
                $route = $this->createRoute($route);

                $collections[$key]->add($route);
            }
        }

        return is_null($version) ? $collections : $collections[$version];
    }
318291
public function addCollection($key, RouteCollection $routes, $prefix = null)
    {
        $this->routes[$key] = new RouteCollectionUrlGenerator(
            $this->app->url($prefix),
            $routes
        );

        return $this;
    }
1201327
protected function addToCollections($route)
    {
        $domainAndUri = $route->getDomain().$route->uri();

        if ($route->hasCondition() && ! empty($route->getConditionParameters())) {
            $domainAndUri .= serialize($route->getConditionParameters());
        }

        foreach ($route->methods() as $method) {
            $this->routes[$method][$domainAndUri] = $route;
        }

        $this->allRoutes[$method.$domainAndUri] = $route;
    }
1114092
protected function localizeCollectionLocaleParameter($prefix, RouteCollection $collection)
    {
        $localizedPrefixes = array();
        foreach ($collection->all() as $name => $route) {
            $locale = $route->getDefault(self::LOCALE_PARAM);
            if ($locale === null) {
                // No locale so nothing to do
                $routePrefix = $prefix;
            } else {
                // A locale was found so localize the prefix
                if (!isset($localizedPrefixes[$locale])) {
                    $localizedPrefixes[$locale] = preg_replace(static::LOCALE_REGEX, $locale, $prefix);
                }
                $routePrefix = $localizedPrefixes[$locale];
            }
            $route->setPath('/' . $routePrefix . $route->getPath());
        }
    }
758991
private function setRoutes() : void
    {
        $this->routes = $this->routeProvider->getRoutes();
        $this->syRouteCollection = new RouteCollection();
        foreach ($this->routes as $route) {
            $syRoute = new SymfonyRoute(
                $route->getPath(),
                $route->getParamsDefaults(),
                $route->getParamsRequirements(),
                [],
                '',
                [],
                $route->getMethods()
            );
            $this->syRouteCollection->add($route->getName(), $syRoute);
        }
    }
1364395
public function add(array $collection)
    {
        foreach ($collection as $data) {
            $breadcrumb = new Breadcrumb();
            $breadcrumb->setName($data['name'])
                       ->setLink(isset($data['link']) ? $data['link'] : '#');

            array_push($this->collection, $breadcrumb);
        }

        return $this;
    }
1082056
public function load($resource, $type = null)
    {
        $collection = new RouteCollection();
        
        foreach ($this->routes as $resource) {
            $collection->addCollection(
                  $this->import($resource, NULL)
                  );
        }
        
        return $collection;
    }
432302
public function collect($job_list) {
    $route_provider = \Drupal::service('router.route_provider');
    // TODO: figure out how on earth getRoutesByPattern() is meant to work!
    $routes = $route_provider->getAllRoutes();

    $admin_routes = [];
    foreach ($routes as $route_name => $route) {
      $controller = $route->getDefault('_controller');
      if ($controller == '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage') {
        $route_path = $route->getPath();

        // Skip the '/admin' path, as you don't put items there.
        if ($route_path == '/admin') {
          continue;
        }

        $admin_routes[$route_name] = [
          'route_name' => $route_name,
          'path' => $route_path,
          'title' => $route->getDefault('_title'),
        ];
      }
    }

    return $admin_routes;
  }
1219129
public function create(RouteCollection $routes): Tree
    {
        $routesArray = $routes->all();

        $routesPaths = array_map(function (Route $route) {
            return $this->serializer->serialize($route->getPath());
        }, $routesArray);

        $tree = new Tree();

        /** @var RoutePath[] $pathArray */
        foreach ($routesPaths as $index => $pathArray) {
            $route = $routesArray[$index];

            /** @var TreeNode $treeNode */
            $treeNode = $tree;

            foreach ($pathArray as $path) {
                $treeNode = $this->addPathPartToTree($treeNode, $path, $route, $index);
            }
        }

        return $tree;
    }
1154666
public function addRoute($method, $route, $callback)
    {
        return $this->routes[] = new Route(strtoupper($method), $route, $callback);
    }
1131491
private function addCustomRoutes()
    {
        foreach (Route::getRoutes() as $route) {
            $this->_router->respond($route['method'], $route['path'], $route['callback']);
        }
    }
1313650
public function setRoutes( RouteCollection $routes )
	{
		foreach ( $routes as $route )
			$route->setRouter( $this );

		$this->routes = $routes;
	}
770587
public function generateCollection($localesWithPrefix, RouteCollection $baseCollection)
    {
        if (is_array($localesWithPrefix)) {
            $this->assertLocalesAreSupported(array_keys($localesWithPrefix));
        }
        return $this->routeGenerator->generateCollection($localesWithPrefix, $baseCollection);
    }
1127051
protected function addToCollections($route)
	{
		$domainAndUri = $route->domain() . $route->getUri();

		foreach ($route->methods() as $method)
		{
			$this->routes[$method][$domainAndUri] = $route;
		}

		$this->allRoutes[$method . $domainAndUri] = $route;
	}
207229
public function addRoute(array $routeArray)
    {
        $routeKeys = array_keys($routeArray);
        $routeValues = array_values($routeArray);

        $routeName = reset($routeKeys);
        $route = reset($routeValues);

        $this->routes[$routeName] = $route;

        return $this;
    }