Register a new route responding to all verbs.

@param string                    $uri
@param Closure|array|string|null $action

@return Route
968703
public function all($uri, $action = null)
    {
        $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'];

        return $this->addRoute($verbs, $uri, $action);
    }
500755
public static function Route($route, $controller, $closure = null) {
        $route = strtolower($route);
        $controller = ucwords(strtolower($controller));
        $request = KernelHttp::request();
        if($request->getUrlApi() == $route)
            self::explorer($route, $controller, $closure, $request);
    }
838375
public function match($methods, $uri, $action)
    {
        return $this->addRoute(\array_map('strtoupper', (array) $methods), $uri, $action);
    }
1144471
public function addRoute($methods, $uri, $action)
    {
        if (is_string($action)) {
            $action = ['uses' => $action];
        } elseif ($action instanceof Closure) {
            $action = [$action];
        }

        $action = $this->mergeLastGroupAttributes($action);

        $uri = $uri === '/' ? $uri : '/'.trim($uri, '/');

        if (! empty($action['prefix'])) {
            $uri = '/'.rtrim(trim($action['prefix'], '/').'/'.trim($uri, '/'), '/');

            unset($action['prefix']);
        }

        $action['uri'] = $uri;

        $action = $this->addRouteMiddlewares($action);

//        echo $action;
//        return $this->adapter->addRoute((array) $methods, $action['version'], $uri, $action);
        return $this->addRoute((array) $methods, $action['version'], $uri, $action);
    }
1136337
protected function createRoute($methods, $uri, $action)
    {
        if (is_callable($action)) {
            $action = array('uses' => $action);
        }

        // If the route is routing to a controller we will parse the route action into
        // an acceptable array format before registering it and creating this route
        // instance itself. We need to build the Closure that will call this out.
        else if ($this->actionReferencesController($action)) {
            $action = $this->convertToControllerAction($action);
        }

        // If no "uses" property has been set, we will dig through the array to find a
        // Closure instance within this list. We will set the first Closure we come
        // across into the "uses" property that will get fired off by this route.
        else if (! isset($action['uses'])) {
            $action['uses'] = $this->findActionClosure($action);
        }

        if (isset($action['middleware']) && is_string($action['middleware'])) {
            $action['middleware'] = explode('|', $action['middleware']);
        }

        $route = $this->newRoute(
            $methods, $uri = $this->prefix($uri), $action
        );

        // If we have groups that need to be merged, we will merge them now after this
        // route has already been created and is ready to go. After we're done with
        // the merge we will be ready to return the route back out to the caller.
        if (! empty($this->groupStack)) {
            $this->mergeGroupAttributesIntoRoute($route);
        }

        $this->addWhereClausesToRoute($route);

        return $route;
    }
44068
protected function setShowRoute($controller, $action): Controller
    {
        $this->routes['get'] = array_merge($this->routes['get'], [
            "/$controller/$action/{:id}/" => Inflector::classify($controller) . '@' . $action,
        ]);

        return $this;
    }
207447
public function any($methods, $uri, $action = null)
    {
        return $this->addRoute(array_map('strtoupper', (array)$methods), $uri, $action);
    }
779661
public function addRoute(string $path, string $controller, string $action = 'index', string $method = Request::METHOD_GET) : self
    {
        $endPoint = new RouteEndpoint($this->namespace, $controller, $action, $method);
        $this->routes[] = new Route($path, $endPoint);
        
        return $this;
    }
1184143
protected function newRoute($methods, $uri, $action)
    {
        $route = (new Route($methods, $uri, $action))->setContainer($this->container);
        $priority = self::DEFAULT_PRIORITY - $this->routes->count();
        $route->setPriority($priority);

        return $route;
    }
419418
public function get(string $uri, $action): self
    {
        $this->routes['GET'][$this->trimTrailingSlashes($uri)] = $action;

        return $this;
    }
821589
public function setAction($action)
    {
        foreach ($this->routes as $route)
            $route->setAction($action);
        return $this;
    }
922091
public function restful($uri, $action)
    {
        $uri = rtrim($uri, '/');
        $control = strtolower(strtr($action, ['Controller' => '']));

        $this->addRoute('GET', $uri, ['uses' => $action.'@index', 'as' => $control.'.index']);
        $this->addRoute('GET', $uri.'/{id}', ['uses' => $action.'@show', 'as' => $control.'.show']);

        $this->addRoute('GET', $uri.'/create', ['uses' => $action.'@create', 'as' => $control.'.create']);
        $this->addRoute('POST', $uri, $action.'@store');

        $this->addRoute('GET', $uri.'/{id}/edit', ['uses' => $action.'@edit', 'as' => $control.'.edit']);
        $this->addRoute('PUT', $uri.'/{id}', $action.'@update');

        $this->addRoute('DELETE', $uri.'/{id}', $action.'@destroy');

        return $this;
    }
1135940
public function match($methods, $uri, $action)
    {
        return $this->router->match($methods, $uri, $action);
    }
743128
public function resolve(Router $router, $uri, $method)
	{
		// get all register routes with the same request method
		$routes = $router->getRoutesByMethod($method);
		// remove trailing and leading slash
		$requestedUri = trim(preg_replace('/\?.*/', '', $uri), '/');
		// loop trough the posible routes
		foreach ($routes as $route) {
			$matches = array();

			// if the requested route matches one of the defined routes
			if ($route->getUrl() === $requestedUri || preg_match('~^'.$route->getUrl().'$~', $requestedUri, $matches)) {
				$argumentArray = array();
				$arguments = $this->getArguments($matches);

				// check if there route has arguments
				if (is_array($route->getArguments()) && count($route->getArguments()) > 0) {
					// loop trough all the arguments
					foreach ($route->getArguments() as $key => $argument) {
						// if the argument exists set the value
						if (isset($arguments[$key])) {
							$argumentArray[$argument] = $arguments[$key];
						} else {
							// setting the value to null should only occure when we use an optional parameter
							$argumentArray[$argument] = null;
						}
					}
				}

				return [
					'code' => Route::STATUS_FOUND,
					'handler' => $route->getAction(),
					'arguments' => $argumentArray
				];
			}
		}

		return [
			'code' => Route::STATUS_NOT_FOUND,
			'handler' => null,
			'arguments' => []
		];
	}
946495
public function Link($action = null)
    {
        return Controller::join_links(
            Director::BaseURL(),
            $this->config()->url_segment,
            $action
        );
    }
946954
public function registerActionAlias($alias, $action)
    {
        $alias = strtolower($alias);

        if (! in_array($alias, $this->getActions()))  {
            $this->_action_map[$alias] = $action;
        }

        //Force reload of the actions
        $this->_actions = array_unique(array_merge($this->_actions, array_keys($this->_action_map)));

        return $this;
    }
782103
public function setAction($action)
	{
		if (!(is_object($action) && ($action instanceof \Closure)) && ($action === null || $action === '')) {
			throw new InvalidArgumentException('Action should be a Closure or a path to a function');
		}

		$this->action = $action;

		return $this;
	}