Parse the admin module's route configuration.

@see    \Charcoal\App\AppConfig::setRoutes() For a similar implementation.
@param  array $routes The route configuration structure to set.
@return self
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;
    }
869129
protected function setAliases(array $routes)
    {
        foreach ($routes as $command => $route) {

            if (!isset($route['alias'])) {
                continue;
            }

            if (isset($this->aliases[$route['alias']])) {
                throw new OverflowException("Command alias '{$route['alias']}' is not unique");
            }

            $this->aliases[$route['alias']] = $command;
        }
    }
680144
protected function parseRoutes(array $allRoutes)
    {
        return Collection::make($allRoutes)
            ->partition(function ($route) {
                return ! Str::startsWith($route, ['not:']);
            })
            ->transform(function (Collection $routes, $index) {
                return $index === 0
                    ? $routes
                    : $routes->transform(function ($route) { return substr($route, 4); });
            })
            ->toArray();
    }
1363240
public static function matchAll(array $routes)
    {
        foreach ($routes as $mapping) {
            list($methods, $route, $target, $name, $middleware) = $mapping;
            static::getInstance()->map($methods, $route, $target, $name, $middleware);
        }

        return static::getInstance();
    }
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;
        }
    }
1245558
public function setRouting(array $routings = [])
    {
        $this->dispatcher = null;
        $this->routings = $routings + $this->routings;

        foreach ($this->routings as $name => &$routing) {
            if (1 == count($routing)) {
                array_unshift($routing, '/' . ltrim($name, '/'));
            }
            if (2 == count($routing)) {
                array_unshift($routing, ['GET', 'POST']);
            }
        }
    }
246717
public function addOnRoute($name, array $routes)
    {
        $route = $this->findRoute($name);

        // if has subroutes, use the that subroutes, else, create a new subroute.
        if($route->hasSubroutes())
            $route->getSubroutes()->addRoutes($routes);
        else
            $route->setSubroutes($routes);

        return $this;
    }
908289
public function find(Request $request, array $routes)
    {
        foreach ($routes as $route) {

            if(!$this->matchMethod($request, $route)){
                continue;
            }

            if(!$this->matchContentType($request, $route)){
                continue;
            }

            if(!$this->matchFilters($route)){
                continue;
            }

            $routeMatches = $this->matchPattern($request, $route);
            if ($routeMatches) {
                $route->setMatches($routeMatches);
                return $route;
            }
        }
        throw new RouteException(
            sprintf('No route found for uri "%s"', $request->getRequestUri()),
            $request,
            $routes
        );
    }
109219
public function appendRoutes(ConfigObject $routes)
    {
        /* @var $routeConfig ConfigObject */
        foreach ($routes as $name => $routeConfig) {
            self::$routeCollection->add($name, $this->loader->processRoute($routeConfig));
        }

        return $this;
    }
605441
public function addRoute(Route $route)
	{
		foreach ($route->getMethods() as $method)
		{
			$this->routes[$method][/*$route->uri*/] = $route;
		}
		
		$this->allRoutes[] = $route;

		return $this;
	}
895796
public function setRoute($route, array $params = array())
    {
        $this->route = $route;
        $this->routeParams = $params;

        return $this;
    }
1110610
private function applyGroupSettings(Route $route) : Route
    {
        $route->setRawPath($this->getGroupPath() . $route->getRawPath());
        $route->setRawHost($this->getGroupHost() . $route->getRawHost());

        if (!$route->usesCallable()) {
            $route->setControllerName($this->getGroupControllerNamespace() . $route->getControllerName());
        }

        $route->setSecure($this->groupIsSecure() || $route->isSecure());
        // The route's variable regexes take precedence over group regexes
        $route->setVarRegexes(array_merge($this->getVarRegexes(), $route->getVarRegexes()));
        $groupMiddleware = $this->getGroupMiddleware();

        if (count($groupMiddleware) > 0) {
            $route->addMiddleware($groupMiddleware, true);
        }

        return $route;
    }
896582
public function method(string ...$methods) : RouteBuilder
    {
        foreach ($this->routes as $route) {
            $route->allows($methods);
        }
        return $this;
    }
456331
private function searchRouter($routes) 
    {
        foreach ($routes as $route) {
            if (!preg_match_all('#^' . $route['request'] . '$#', $this->request, $matches, PREG_OFFSET_CAPTURE))
                continue;
            // Rework matches to only contain the matches, not the orig string
            $matches = array_slice($matches, 1);

            // Extract the matched URL parameters (and only the parameters)
            $params = array_map(function ($match, $index) use ($matches) {

                // We have a following parameter: take the substring from the current param position until the next one's position (thank you PREG_OFFSET_CAPTURE)
                if (isset($matches[$index + 1]) && isset($matches[$index + 1][0]) && is_array($matches[$index + 1][0])) {
                    return trim(substr($match[0][0], 0, $matches[$index + 1][0][1] - $match[0][1]), '/');
                } // We have no following parameters: return the whole lot
                else {
                    return (isset($match[0][0]) ? trim($match[0][0], '/') : null);
                }
            }, $matches, array_keys($matches));

            $route['params'] = $params;
            return $route;
        }
        //not exists ...
        return false;
    }
820837
public function isPath($routes)
    {
        $routes = is_array($routes) ? $routes : func_get_args();

        return call_user_func_array([$this->request, 'is'], $routes);
    }
762939
protected function configureRoutes(RouteCollectionBuilder $routes)
    {
        foreach ($this->routes as $route) {
            is_array($route)
                ? $routes->add(
                    $route[0],
                    $route[1],
                    $route[2]
                )
                : $routes->import($route);
        }
    }
662927
public function setDefaults(array $defaults): self
    {
        foreach ((array)$defaults as $key => $value) {
            if (isset($this->defaults[$key])) {
                $this->defaults[$key] = $value;
            } else {
                throw new Exception('Invalid route default', Exception::HTTP_INTERNAL_SERVER_ERROR);
            }
        }

        return $this;
    }