Add multiple routes at once from array in the following format:.

@param $routes = [route,param,method,middleware]

@since 2.0.3

@return void
503352
public function addRoutes($routes)
    {
        if (!is_array($routes) && !$routes instanceof Traversable) {
            throw new \Exception('Routes should be an array or an instance of Traversable');
        }
        foreach ($routes as $route) {
            call_user_func_array([$this, 'add'], $route);
        }
    }
850476
public function add($route)
    {
        if (!$route instanceof Route) {
            $route = new Route($route);
        }

        return $this->addRoute($route);
    }
22588
public function group(array $routes)
    {
        $group = new Group;
        foreach ($routes as $route)
            $group->set($route);
        return $group;
    }
626197
public function addRoutes(array $routes)
    {
        foreach($routes as $name => $routeData)
            $this->addRoute($this->factory->createRoute($this, $name, $routeData));

        return $this;
    }
468833
public function addRoutes(array $routes)
    {
        foreach ($routes as $route => $endpoint) {
            // Add route as key. Use rtrim to remove any existing trailing slash, and then
            // add a new trailing slash
            $route = ($route !== '/') ? rtrim($route, '/') : '/';
            $this->routes[$route] = $endpoint;
        }
    }
841206
public function addRoute(string $prefix, $route)
    {
        list($prefix, $staticPrefix) = $this->getCommonPrefix($prefix, $prefix);

        for ($i = \count($this->items) - 1; 0 <= $i; --$i) {
            $item = $this->items[$i];

            list($commonPrefix, $commonStaticPrefix) = $this->getCommonPrefix($prefix, $this->prefixes[$i]);

            if ($this->prefix === $commonPrefix) {
                // the new route and a previous one have no common prefix, let's see if they are exclusive to each others

                if ($this->prefix !== $staticPrefix && $this->prefix !== $this->staticPrefixes[$i]) {
                    // the new route and the previous one have exclusive static prefixes
                    continue;
                }

                if ($this->prefix === $staticPrefix && $this->prefix === $this->staticPrefixes[$i]) {
                    // the new route and the previous one have no static prefix
                    break;
                }

                if ($this->prefixes[$i] !== $this->staticPrefixes[$i] && $this->prefix === $this->staticPrefixes[$i]) {
                    // the previous route is non-static and has no static prefix
                    break;
                }

                if ($prefix !== $staticPrefix && $this->prefix === $staticPrefix) {
                    // the new route is non-static and has no static prefix
                    break;
                }

                continue;
            }

            if ($item instanceof self && $this->prefixes[$i] === $commonPrefix) {
                // the new route is a child of a previous one, let's nest it
                $item->addRoute($prefix, $route);
            } else {
                // the new route and a previous one have a common prefix, let's merge them
                $child = new self($commonPrefix);
                list($child->prefixes[0], $child->staticPrefixes[0]) = $child->getCommonPrefix($this->prefixes[$i], $this->prefixes[$i]);
                list($child->prefixes[1], $child->staticPrefixes[1]) = $child->getCommonPrefix($prefix, $prefix);
                $child->items = [$this->items[$i], $route];

                $this->staticPrefixes[$i] = $commonStaticPrefix;
                $this->prefixes[$i] = $commonPrefix;
                $this->items[$i] = $child;
            }

            return;
        }

        // No optimised case was found, in this case we simple add the route for possible
        // grouping when new routes are added.
        $this->staticPrefixes[] = $staticPrefix;
        $this->prefixes[] = $prefix;
        $this->items[] = $route;
    }
606956
public function addRoutes($routes)
    {
        if (!is_array($routes)) {
            throw new \InvalidArgumentException("Routes must be an array");
        }

        $routes = array_filter($routes, function ($route) {
            return is_a('Route', $route);
        });

        $this->routes = array_merge($this->routes, $routes);
    }
433470
public static function configureRoutes(GroupInterface $routes): void
    {
        $routes->group('', function (GroupInterface $routes): void {

            $routes->addContainerConfigurators([
                L10nContainerConfigurator::CONFIGURATOR,
            ]);

            for ($i = 0; $i < 10 + 10 * 5; ++$i) {
                $routes->post("/posts$i/create", [PostsController::class, PostsController::METHOD_CREATE]);
            }

        });
    }
1111462
public function addRoute(array $methods, string $route, $handler): void
    {
        if ($methods === []) {
            throw new \InvalidArgumentException('Methods is empty');
        }

        if (\is_callable($handler)) {
            $handler = \Closure::fromCallable($handler);
        } elseif (!\is_array($handler)) {
            throw new \InvalidArgumentException('Handler is not a valid type: ' . \var_export($handler, true));
        }

        $parts = \explode('/', \trim($route, static::SEPARATOR_TRIM));

        if (!isset($parts[1]) && $parts[0] === '') {
            $parts = [];
        }

        $current = &$this->routes;
        foreach ($parts as $v) {
            if ($v[0] === '{' && $v[-1] === '}') {
                $v = \substr($v, 1, -1);
                if (\strpos($v, ':') !== false) {
                    [$name, $regexp] = \explode(':', $v, 2);

                    $regexp = '/^' . $regexp . '$/';
                    if (!isset($current['regexps'][$regexp])) {
                        $current['regexps'][$regexp] = [
                            'children' => [],
                            'regexps' => [],
                            'name' => $name,
                        ];
                    }
                    $current = &$current['regexps'][$regexp];
                } else {
                    if (!isset($current['others'])) {
                        $current['others'] = [
                            'children' => [],
                            'regexps' => [],
                            'name' => $v,
                        ];
                    }
                    $current = &$current['others'];
                }
            } else {
                if (!isset($current['children'][$v])) {
                    $current['children'][$v] = [
                        'children' => [],
                        'regexps' => [],
                    ];
                }
                $current = &$current['children'][$v];
            }
        }

        $current['route'] = $route;

        if (!isset($current['methods'])) {
            $current['methods'] = [];
        }

        foreach ($methods as $v) {
            $current['methods'][\strtoupper($v)] = $handler;
        }
    }
1082947
public function addAll(Paths $paths) {
		foreach ($paths as $p) {
			$path = $this->get($p->getPath());
			foreach ($p->getMethods() as $method) {
				$path->setOperation($method, $p->getOperation($method));
			}
		}
	}
86168
public function createGroup(array $routes = array(), Route $route = null)
    {
        return $this->create('group', array($this, $route, $routes));
    }
550633
protected function addToCollections($route)
    {
        $fullUri = $route->getDomain() . $route->getUri();

        $method = null;
        foreach ($route->getMethods() as $method) {
            $this->routes[$method][$fullUri] = $route;
        }

        $this->allRoutes[$method . $fullUri] = $route;
    }
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);
        }
    }
605441
public function addRoute(Route $route)
	{
		foreach ($route->getMethods() as $method)
		{
			$this->routes[$method][/*$route->uri*/] = $route;
		}
		
		$this->allRoutes[] = $route;

		return $this;
	}
1304309
public function addRequirements(array $requirements)
    {
        if ($requirements) {
            foreach ($this->routes as $route) {
                $route->addRequirements($requirements);
            }
        }
    }
423438
public function setRoutes(array $routes)
    {
        $toIterate = RouteConfig::defaultRouteTypes();
        foreach ($routes as $key => $val) {
            if (in_array($key, $toIterate) && isset($this->routes[$key])) {
                $this->routes[$key] = array_merge($this->routes[$key], $val);
            } else {
                $this->routes[$key] = $val;
            }
        }

        return $this;
    }
802931
public function setRoutes() : void
    {
        if (is_null($this->routes)) {
            $this->routes = [];
            $routesConfig = $this->config->getParam('routes') ?? [];
            foreach ($routesConfig as $routeName => $routeArr) {
                $route = new Route(
                    $routeName,
                    $routeArr['methods'],
                    $routeArr['path'],
                    $routeArr['params_defaults'],
                    $routeArr['params_requirements'],
                    $routeArr['handler'],
                    $routeArr['handler_method'] ?? null
                );
                $this->routes[] = $route;
            }
        }
    }