Store a route in the route collection

@param  array $methods
@param  array $route
485250
protected function storeRoute(array $methods, array $route)
    {
        $this->callbacks[] = (object)$route;
        $index             = count($this->callbacks) - 1;

        if (!isset($this->routes[$route['pattern']])) {
            $this->routes[$route['pattern']] = [];
        }

        if ($route['name']) {
            $this->names[$route['name']] = $index;
        }

        foreach ($methods as $method) {
            $this->routes[$route['pattern']][strtoupper($method)] = $index;
        }
    }
1371995
protected function registerInspected($route, $controller, $method, &$names)
	{
		$action = array('uses' => $controller.'@'.$method);

		// If a given controller method has been named, we will assign the name to the
		// controller action array, which provides for a short-cut to method naming
		// so you don't have to define an individual route for these controllers.
		$action['as'] = array_pull($names, $method);

		$this->{$route['verb']}($route['uri'], $action);
	}
859931
private function executeRouteMiddleware(Route &$route, $position, $method)
    {
        $method = strtoupper($method);

        /** @var Middleware[] $middleware */
        $middleware = array();
        $continue   = true;

        // Get all global middleware's.
        if (isset(
                $this->middleware['global'],
                $this->middleware['global'][$position])
            && count($this->middleware['global'][$position]) > 0) {

            $middleware = array_merge($middleware, $this->middleware['global'][$position]);
        }

        // Group middleware if defined.
        if ($route->getGroup() !== null
            &&  isset($this->middleware[$route->getGroup()],
                $this->middleware[$route->getGroup()][$position])
            && count($this->middleware[$route->getGroup()][$position]) > 0) {
            $middleware = array_merge($middleware, $this->middleware[$route->getGroup()][$position]);
        }


        // Will execute all middleware in order..:
        foreach ($middleware as $trigger)
        {
            if (count($trigger->getMethods()) === 0
            ||  in_array(strtoupper($method), $trigger->getMethods())) {

                if ($this->executeMiddleware($trigger) === false) {
                    $continue = false;
                }
            }
        }

        return $continue;
    }
522554
private function createMaps(RouteCollectionInterface $routes)
    {
        foreach ($routes->all() as $name => $route) {
            foreach ($route->getMethods() as $method) {
                $this->mMap[$method][] = $name;
            }

            foreach ($route->getSchemes() as $scheme) {
                $this->scMap[$scheme][] = $name;
            }

            $this->spMap[$route->getContext()->getStaticPath()][] = $name;
        }
    }
585593
protected function setRouteProperties(Route $route, array $data)
    {
        $methods = get_class_methods(Route::class);
        $methods = array_diff($methods, ["allows", "path"]);
        foreach($data as $method => $args) {
            if (in_array($method, $methods)) {
                $route->$method($args);
            }
        }
        return $route;
    }
942461
public function addRoute($methods, $uri, $action)
    {
        // We do not keep routes in ApiRouter. Whenever a route is added,
        // we add it to Laravel's primary route collection
        $routes = app("router")->getRoutes();
        $prefix = config("api.prefix");

        if (empty($this->versions)) {
            if (($default = config("api.default_version")) !== null) {
                $versions = [$default];
            }
            else {
                $versions = [null];
            }

        }
        else {
            $versions = $this->versions;
        }


        // Add version prefix
        foreach ($versions as $version) {
            // Add ApiMiddleware to all routes
            $route = $this->createRoute($methods, $uri, $action);
            $route->middleware(ApiMiddleware::class);

            if ($version !== null) {
                $route->prefix($version);
                $route->name("." . $version);
            }

            if (!empty($prefix)) {
                $route->prefix($prefix);
            }

            $routes->add($route);

            // Options route
            $route = $this->createRoute(['OPTIONS'], $uri, function () {
                return [];
            });

            $route->middleware(ApiMiddleware::class);

            if ($version !== null) {
                $route->prefix($version);
                $route->name("." . $version);
            }

            if (!empty($prefix)) {
                $route->prefix($prefix);
            }

            $routes->add($route);
        }

        app("router")->setRoutes($routes);
    }
596884
public function processRoutes($routes)
	{
		if (is_null($this->openAPI->paths)) {
			$this->openAPI->paths = [];
		}

		foreach ($routes as $route) {
			$this->processRoute($route);
		}

	}
1297958
public function addRoutes(array $routes = [])
    {
        foreach($routes as $route)
        {
            if ($route instanceof RouteInterface) $this->routes[] = $route;
        }
    }
238614
protected function checkRoutesValidity(array $routes): void
    {
        $requiredRouteKeys = ['index'];
        $optionalRouteKeys = ['create', 'edit', 'destroy'];
        $allowedRouteKeys = array_merge($requiredRouteKeys, $optionalRouteKeys);
        $this->checkRequiredRoutesValidity($routes, $requiredRouteKeys);
        $this->checkAllowedRoutesValidity($routes, $allowedRouteKeys);
        $this->checkRoutesStructureValidity($routes);
    }
312126
protected function registerInspected($route, $controller, $method, &$names)
    {
        $action = ['uses' => $controller . '@' . $method];
        
        // If a given controller method has been named, we will assign the name to the
        // controller action array, which provides for a short-cut to method naming
        // so you don't have to define an individual route for these controllers.
        $action['as'] = array_get($names, $method);
        $this->{$route['verb']}($route['uri'], $action);
    }
829983
public function setRoutes(array $routes) {

	    foreach($routes as $route) {

	        if(!$route instanceof Route) {
	            throw new \InvalidArgumentException(sprintf("'%s' is not a Route instance.", $route));
            }

            $this->addRoute($route);

        }

    }
398024
public function remove($method, $route)
	{
		if (!array_key_exists($method, $this->routes)) {
			return;
		}

		foreach ($this->routes[$method] as $key => $entry) {
			if ($entry->route == $route) {
				unset($this->routes[$method][$key]);
			}
		}

		if (count($this->routes[$method]) == 0) {
			unset($this->routes[$method]);
		}
	}
635489
public function setAdapterRoutes(array $routes)
    {
        $this->adapter->setRoutes($routes);

        $this->container->instance('api.routes', $this->getRoutes());
    }
1364944
private function filterByMethodAndScheme(RouteCollectionInterface $routes, Request $context)
    {
        return $routes->findByMethod($context->getMethod())->findByScheme($context->getScheme());
    }
495743
public function add($methods, $route, $settings, $callback = null)
    {
        if($this->cacheLoaded) {
            return true;
        }

        if (is_null($callback)) {
            $callback = $settings;
            $settings = null;
        }

        if (strstr($methods, '|')) {
            foreach (array_unique(explode('|', $methods)) as $method) {
                if ($method != '') {
                    call_user_func_array([$this, strtolower($method)], [$route, $settings, $callback]);
                }
            }
        } else {
            call_user_func_array([$this, strtolower($methods)], [$route, $settings, $callback]);
        }

        return true;
    }
896137
protected function store(array $routes = [])
    {
        // Get cache instance - at this point all PSR-6 compatibles are allowed
        $cache = $this->getRegistry()->getCache();

        // Check if we use scopes ...
        if ($cache instanceof Doozr_Cache_Service) {
            $cache->create(
                $this->getUuid(),
                $routes,
                null,
                $this->getScope()
            );

        } else {
            $item = new CacheItem($this->getUuid());
            $item->set($routes);

            $cache->save($item);
        }
    }
203864
public function forwardToRoute($route, $method, array $parameters = [])
    {
        return $this->forward($this['url_generator']->generate($route, $parameters), $method);
    }