Load content from a route and return details to view.

@param string $route to load content from.

@return array with values to extract in view.
484602
public function getContentForRoute($route)
    {
        $content = $this->di->get("content")->contentForInternalRoute($route);
        return $content->views["main"]["data"];
    }
979626
public function gatherRouteMiddlewares( Route $route )
	{
		return Collection::make( $route->middleware() )->map( function ( $name )
		{
			return Collection::make( $this->resolveMiddlewareClassName( $name ) );
		} )->flatten()->all();
	}
324106
public function getAliases($route)
    {
        $aliases = [];

        if (is_array($this->routes[$route]) && array_key_exists('aliases', $this->routes[$route])) {
            $aliases = $this->routes[$route]['aliases'];
        }

        return $aliases;
    }
165833
private function getMiddleWareFromRoute(Route $route)
    {
        if (!$route->group) {
            return $route->middleWare;
        }
        $groupMiddleWare = $this->getMiddleWareFromGroup($route->group);
        return \array_merge($groupMiddleWare, $route->middleWare);
    }
70719
public function contentForRoute($route = null)
    {
        $content = $this->contentForInternalRoute($route);
        if ($content->internal === true) {
            $msg = t("The content '!ROUTE' does not exists as a public route.", ["!ROUTE" => $route]);
            throw new \Anax\Exception\NotFoundException($msg);
        }

        return $content;
    }
483824
public function gatherRouteMiddleware(Route $route)
    {
        $middleware = collect($route->gatherMiddleware())->map(function ($name) {
            return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups);
        })->flatten();

        return $this->sortMiddleware($middleware);
    }
1894
protected function getRouteUrlWithBindings($route)
	{
		$urlRouteBindings = [];
		$urlInjectedBindings = [];

		$routeAction = $route->getAction();
		if (isset($routeAction['as'])) {
			if (isset($this->profile['api_calls_bindings'])) {
				foreach ($this->profile['api_calls_bindings'] as $apiCallsBinding) {
					$routesAliases = $apiCallsBinding['routes_aliases'];
					foreach ($routesAliases as $routeAlias) {
						if ($routeAlias == $routeAction['as']) {
							foreach ($apiCallsBinding['bindings'] as $binding) {
								if ($binding['in'] == 'query-route') {
									$urlRouteBindings[$binding['name']] = $binding['value'];
								} else if ($binding['in'] == 'query-injected') {
									$urlInjectedBindings[$binding['name']] = $binding['value'];
								}
							}
						}
					}
				}
			}
		}

		$url = $this->getRouteUri($route);

		foreach ($urlRouteBindings as $name => $value) {
			$url = str_replace('{'.$name.'}', $value, $url);
		}

		if (count($urlInjectedBindings) > 0) {
			$firstName = array_keys($urlInjectedBindings)[0];
			$firstValue = array_shift($urlInjectedBindings);
			$url .= '?' . $firstName . '=' . $firstValue;
			foreach ($urlInjectedBindings as $name => $value) {
				$url .= '&' . $name . '=' . $value;
			}
		}

		return $url;
	}
184353
private function prepareRouteRegexp(string $route): string
    {
        if (!array_key_exists($route, self::$parsed_regexp)) {
            self::$parsed_regexp[$route] = preg_replace(array_keys($this->regexp_map), array_values($this->regexp_map), $route);
        }
        return self::$parsed_regexp[$route];
    }
97482
public function gatherRouteMiddlewares(Route $route)
    {
        return Collection::make($route->middleware())->map(function ($m) {
            return Collection::make(array_get($this->middleware, $m, $m));
        })->collapse()->all();
    }
1290390
protected function getPatternFilters($route)
    {
        $patterns = [];

        foreach ($route->methods() as $method) {
            $inner = $this->getMethodPatterns($route->uri(), $method);

            $patterns = array_merge($patterns, array_keys($inner));
        }

        return $patterns;
    }
163273
private function createResponse($route): ?Response
    {
        $controller = $this->getRouteControllerInstance($route);
        if (!is_null($controller)) {
            $responseBefore = $controller->before();
            if ($responseBefore instanceof Response) {
                return $responseBefore;
            }
        }

        $values = $route['route']->getArguments($this->requestedUri);
        $this->loadRequestParameters($values);
        $callback = new Callback($route['callback']);
        $arguments = $this->getFunctionArguments($callback->getReflection(), array_values($values));
        $response = $callback->executeArray($arguments);

        if (!is_null($controller)) {
            $responseAfter = $controller->after($response);
            if ($responseAfter instanceof Response) {
                return $responseAfter;
            }
        }
        return $response;
    }
1290267
protected function getRoutePathParameters($route)
	{
		$parameters = [];

		$routeAction = $route->getAction();
		list($class, $method) = explode('@', $routeAction['uses']);

		$reflection = new ReflectionClass($class);
		$reflectionMethod = $reflection->getMethod($method);

		foreach ($reflectionMethod->getParameters() as $parameter) {
			$reflectionType = $parameter->getType();
			// Only scalar types or undefined types
			if (is_null($reflectionType) || $reflectionType->isBuiltin()) {
				$parameters[$parameter->getName()] = [
					'name' => $parameter->getName(),
				];
				if (!is_null($reflectionType) && $reflectionType->isBuiltin()) {
					$parameters[$parameter->getName()]['type'] = (string)$parameter->getType();
				}
			}
		}

		if (count($parameters) > 0) {
			// Inject the related phpdoc if exists.
			$comment = $reflectionMethod->getDocComment();
			if ($comment) {
				$docBlock = $this->docBlockFactory->create($comment);
				foreach ($docBlock->getTagsByName('param') as $tag) {
					foreach ($parameters as $parameterName => $parameter) {
						if ($tag->getVariableName() == $parameterName) {
							$docDescription = $tag->getDescription()->render();
							/** @var \ReflectionType $reflectionType */
							$reflectionType = $tag->getType();
							$parameters[$parameterName]['docType'] = (string)$reflectionType;
							$parameters[$parameterName]['docDescription'] = $docDescription;
						}
					}
				}
			}
		}

		return $parameters;
	}
1333386
public function findByRoute(string $route): ?PageInterface
    {
        if (!in_array($route, $this->getCmsRoutes(), true)) {
            return null;
        }

        return $this->repository->findOneByRoute($route);
    }
287408
private function overlay(array $route): array
    {
        $target = $this->defaults;

        foreach ($route['route']['target'] as $key => $value) {
            $target[$key] = $value;
        }

        return $target;
    }
889223
protected function getCommandSummary(Route $route)
    {
        $input = $this->resolve($route->input);
        if (! $input instanceof HelpAwareInterface) {
            return 'No description';
        }

        $input->help($this->help);
        return $this->help->getSummary();
    }
982186
protected static function funcPost($route)
    {
        $params = self::dynamic($route);
        //
        if (count($params) > 0) {
            return 'post(\''.$route.'\',function('.self::formatParams($params).')';
        } else {
            return 'post(\''.$route.'\',function()';
        }
    }
226424
private function checkForMetaRoute($route)
    {
        $this->baseRoute = $route;
        $this->metaRoute = null;

        // If route exits in index, use it
        if ($this->mapRoute2IndexKey($route)) {
            return $route;
        }

        // Check for pagination
        $pagination = $this->config["pagination"];
        $matches = [];
        $pattern = "/(.*?)\/($pagination)\/(\d+)$/";
        if (preg_match($pattern, $route, $matches)) {
            $this->baseRoute = $matches[1];
            $this->metaRoute = $route;
            $this->currentPage = $matches[3];
        }

        return $this->baseRoute;
    }