Create an Action from a Route

@param Router\Route $route Route to create action from

@return \Arbiter\Action

@access protected
439553
protected function fromRoute(Router\Route $route)
    {
        return $this->newInstance(
            $route->input,
            $route->domain,
            $route->responder
        );
    }
229947
public function add(Route $route)
    {
        // $this->routes[$route->method()][$route->uri()] = $route;
        $this->routes[$route->method().$route->route()] = $route;
        return $route;
    }
823394
protected function runRouteWithinStack(Route $route, Request $request)
    {
        $skipMiddleware = $this->container->bound('middleware.disable') &&
                          ($this->container->make('middleware.disable') === true);

        // Create a Pipeline instance.
        $pipeline = new Pipeline(
            $this->container, $skipMiddleware ? array() : $this->gatherRouteMiddleware($route)
        );

        return $pipeline->handle($request, function ($request) use ($route)
        {
            $response = $route->run($request);

            return $this->prepareResponse($request, $response);
        });
    }
967679
public function addRoute($route)
    {
        if (!$route instanceof Route && !is_array($route)) {
            throw new \LogicException('Route invalid. Expected Route instance or array.');
        } elseif ($route instanceof Route) {
            $name = $route->getName();
            if (isset($this->routes[$name])) {
                throw new \LogicException(sprintf('Trying to register two routes with the same name "%s"', $name));
            }
            $this->routes[$route->getName()] = $route;
        } elseif (is_array($route) && !count($route) == 4) {
            throw new \LogicException('Array Route invalid. Expected array(string|array method, string pattern, callback|string action, string name).');
        } else {
            list($methods, $patternUri, $action, $name) = array_values($route);
            
            $this->routes[$name] = new Route($methods, $patternUri, $action, $name);
        }
        
        return $this;
    }
503075
protected function validateRoute(Route $route)
    {
        if (!class_exists($route->controller())) {
            throw new Exception("Controller '{$route->controller()}' not found");
        }

        if (!method_exists($route->controller(), $route->action())) {
            throw new Exception("Action '{$route->action()}' does not exist in controller '{$route->controller()}'");
        }
    }
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;
    }
676963
public function setRoute($route)
        {
            if (null !== $route && (!is_string($route) || strlen($route) < 1)) {
                throw new Exception(
                    'Invalid argument: $route must be a non-empty string or null'
                );
            }

            $this->_route     = $route;
            $this->_hrefCache = null;

            return $this;
        }
1158096
private function createContentForInternalRoute($route)
    {
        // Load index and map route to content
        $this->load("index");
        $this->load("meta");
        $this->load("author");
        $this->load("category");
        
        // Match the route
        $route = rtrim($route, "/");
        $route = $this->checkForMetaRoute($route);
        list($routeIndex, $content, $filtered) = $this->mapRoute2Content($route);

        // Create and arrange the content as views, merge with .meta,
        // frontmatter is complete.
        $content["views"] = $this->getViews($routeIndex, $filtered->frontmatter);

        // Do process content step two when all frontmatter is included.
        $this->processMainContentPhaseTwo($content, $filtered);
        
        // Set details of content
        $content["views"]["main"]["data"]["content"] = $filtered->text;
        $content["views"]["main"]["data"]["excerpt"] = $filtered->excerpt;
        $this->loadAdditionalContent($content["views"], $route, $routeIndex);

        // TODO Should not supply all frontmatter to theme, only the
        // parts valid to the index template. Separate that data into own
        // holder in frontmatter. Do not include whole frontmatter? Only
        // on debg?
        $content["frontmatter"] = $filtered->frontmatter;

        return (object) $content;
    }
428558
public function create(ServerRequestInterface $request, Route $route)
    {
        $this->uriGenerator->setRequest($request);
        return new Context($request, $route, $this->uriGenerator);
    }
759386
public function navigationAction($route)
    {
        return $this->render(
            $this->getTemplatePath().'navigation.html.twig',
            array(
                'instance'  => $this->getCurrentInstance(),
                'instances' => $this->getManager()->findAll(),
                'route'     => $route
            )
        );
    }
606735
protected function runRouteWithinStack(Route $route, Request $request)
    {
        $middleware = $this->gatherRouteMiddlewares($route);
        
        return (new Pipeline($this->container))
                        ->send($request)
                        ->through($middleware)
                        ->then(function ($request) use ($route) {
                            return $this->prepareResponse(
                                $request,
                                $route->run($request)
                            );
                        });
    }
106303
public function execute($route)
    {
        Logger::log('Executing the request');
        try {
            //Search action and execute
            return $this->searchAction($route);
        } catch (AccessDeniedException $e) {
            Logger::log(t('Solicitamos credenciales de acceso a zona restringida'), LOG_WARNING, ['file' => $e->getFile() . '[' . $e->getLine() . ']']);
            return Admin::staticAdminLogon($route);
        } catch (RouterException $r) {
            Logger::log($r->getMessage(), LOG_WARNING);
        } catch (\Exception $e) {
            Logger::log($e->getMessage(), LOG_ERR);
            throw $e;
        }

        throw new RouterException(t('Página no encontrada'), 404);
    }
10811
private function trackRoute(Route $route)
    {
        return $this->getModel()->newQuery()->firstOrCreate([
            'name'   => $this->getRouteName($route),
            'action' => $route->getActionName(),
        ])->getKey();
    }
433932
private static function runRouteMiddleware($route)
    {
        $routeMiddleware = Filter::$routeMiddleware;

        if (!is_null($route->getMiddleware())) {
            // if ($route->getMiddleware()['type'] == 'route' && ! is_null($route->getMiddleware()['middlewares'])) {
            foreach ($route->getMiddleware() as $middleware) {
                //Check if the routes middlewares are in filter class
                exception_if(!array_has($routeMiddleware, $middleware), RouteMiddlewareNotFoundException::class, $middleware);

                $middleware = instance($routeMiddleware[$middleware]);

                $middleware->handle(new Request());
            }
        }

        return true;
    }
550863
public function appendRoute(Route $route)
    {
        if (!$originalRoute = optional($this->routes)[$route->slug()]) {
            return "Route {$route->slug()} not found";
        }

        return $this->routes[$route->slug()]['groups'] =
            $originalRoute['groups']->merge($route->get()['groups']);
    }
276169
protected function addToActionList($action, $route)
    {
        $controller = $action['controller'];

        if (! isset($this->actionList[$controller])) {
            $this->actionList[$controller] = $route;
        }
    }
1134480
protected function createRoute( $methods, $uri, $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.
		if ( $this->actionReferencesController( $action ) )
			$action = $this->convertToControllerAction( $action );

		$route = $this->newRoute( $methods, $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 ( $this->hasGroupStack() )
			$this->mergeGroupAttributesIntoRoute( $route );

		$this->addWhereClausesToRoute( $route );

		return $route;
	}