Load view data for additional route, merged with meta if any.

@param string $route to load.

@return array with view data details.
422939
private function getDataForAdditionalRoute($route)
    {
         $filter     = $this->config["textfilter"];
         $textFilter = $this->di->get("textfilter");

        // Get filtered content from route
        list($routeIndex, , $filtered) =
            $this->mapRoute2Content($route);

        // Get meta, remove unneeded details
        $meta = $this->getMetaForRoute($route);
        unset($meta["__toc__"]);
        unset($meta["views"]);

        // Do phase 2 processing to get new filtered content
        // (and updated frontmatter)
        $new = $textFilter->parse($filtered->text, $filter);
        $new->frontmatter = array_merge_recursive_distinct($filtered->frontmatter, $new->frontmatter);

        // Creates urls based on baseurl
        $baseurl = isset($new->frontmatter["data"]["baseurl"])
            ? isset($new->frontmatter["data"]["baseurl"])
            : null;
        $this->addBaseurl2AnchorUrls($new, $baseurl);
        $this->addBaseurl2ImageSource($new, $baseurl);

        // Create complete frontmatter, inluding content
        $frontmatter = $new->frontmatter;
        $frontmatter["data"]["content"] = $new->text;

        // Load additional content for view, based on data-meta
        $view = ["main" => $frontmatter];
        $this->loadAdditionalContent($view, $route, $routeIndex);

        return $view["main"];
    }
435666
protected function getRouteInformation(Route $route)
    {
        if ($route->getName()) {
            return [
                'uri'        => $route->uri(),
                'name'       => $route->getName(),
                'middleware' => $route->middleware(),
            ];
        }

        return null;
    }
482432
public function addRoute(Route $route) {
        if (!in_array($route, $this->routes)) {
            $this->routes[] = $route;
        }
    }
767017
public function loadRoutes()
    {
        $routesJsonFile = $this->configDir . '/routes.json';
        $routesPhpFile = $this->configDir . '/routes.php';
        
        if (file_exists($this->resourcesDir) && file_exists($this->configDir)) {
            if (file_exists($routesJsonFile))
                return json_decode(file_get_contents($routesJsonFile), true);
            elseif (file_exists($routesPhpFile))
                return require_once $routesPhpFile;
        } else {
            return array();
        }
    }
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;
    }
1234280
public function getRouteProperties($route, Request $request)
    {
        $uri = ltrim(isset($route['uri']) ? $route['uri'] : $request->getRequestUri(), '/');
        $methods = isset($route['methods']) ? $route['methods'] : (array) $request->getMethod();
        $action = (isset($route[1]) && is_array($route[1])) ? $route[1] : $route;

        if (in_array('GET', $methods) && ! in_array('HEAD', $methods)) {
            $methods[] = 'HEAD';
        }

        return [$uri, $methods, $action];
    }
79787
protected function getRouteApiParts($route)
    {
        $name = explode('/', $route->getPattern());

        $parts = array(
            'exposed' => false
        );

        // if the name has more than one string pattern
        if (count($name) > 2){
            // get the method name
            $method = array_pop($name);

            // upcase the namespace names
            array_walk($name, function(&$n){
                $n = ucfirst($n);
            });

            $path = implode('', $name);

            $parts = array(
                'path' => $path,
                'exposed' => true,
                'name' => $method,
                'len' => 1
            );

            if ($route->isFormDirect()){
                $parts['formHandler'] = true;
            }

        }

        return $parts;
    }
982124
protected function getRouteInformation(Route $route)
    {
        list($controller, $action) = explode("@", $route->getActionName());

        return [
            'host' => $route->domain(),
            'method' => implode('|', $route->methods()),
            'uri' => $route->uri(),
            'name' => $route->getName(),
            'controller' => $controller,
            'action' => $action,
            'resource' => $route->getActionName(),
            'middleware' => Collection::make($this->getMiddleware($route))
        ];
    }
817239
protected static function funcGet($route)
    {
        $params = self::dynamic($route);
        //
        if (count($params) > 0) {
            return 'get(\''.$route.'\',function('.self::formatParams($params).')';
        } else {
            return 'get(\''.$route.'\',function()';
        }
    }
850476
public function add($route)
    {
        if (!$route instanceof Route) {
            $route = new Route($route);
        }

        return $this->addRoute($route);
    }
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;
    }
1077128
public function getRouteProperties($route, Request $request)
    {
        return [$route->uri(), $route->methods(), $route->getAction()];
    }
287408
private function overlay(array $route): array
    {
        $target = $this->defaults;

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

        return $target;
    }
75177
private function buildParam(Route $route): array
    {
        $param = [];

        $url = \explode('/', $route->url);
        $matches = \explode('/', $this->routeMatches[0]);

        $rawParam = \array_diff($matches, $url);

        foreach ($rawParam as $key => $value) {
            $paramName = \strtr($url[$key], ['[' => '', ']' => '']);
            $param[$paramName] = $value;
        }

        return $param;
    }
61330
private function transformRoute(string $route) : array
    {
        $parameters = $this->extractVariableRouteParts($route);
        foreach ($parameters as $variables) {
            $route = $this->transformRouteVariables($route, $variables);
        }

        $route = '~^'.$route.'$~';

        return [$route, $parameters];
    }
708555
private static function prepareMiddleware(IlluminateRoute $route)
    {
        return array_map(function ($value) {
            return $value instanceof \Closure ? 'Closure' : $value;
        }, self::gatherMiddleware($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();
    }