Map the route to the correct entry in the toc.

@param string $route current route used to access page.
@param array  $toc   the toc as array.

@return string as the title for the content.
196016
public function mapRoute2Toc($route, $toc)
    {
        if (key_exists($route, $toc)) {
            return $route;
        } elseif (key_exists($route . "/index", $toc)) {
            return $route . "/index";
        }

        throw new \Anax\Exception\NotFoundException(t('The page does not exists.'));
    }
970717
protected static function dynamic($route)
    {
        $parms = [];
        $param = '';
        $open = false;
        //
        for ($i = 0; $i < Strings::length($route); $i++) {
            if ($open && $route[$i] != '}') {
                $param .= $route[$i];
            }
            //
            if ($route[$i] == '{' && !$open) {
                $open = true;
            } //
            elseif ($route[$i] == '}' && $open) {
                $open = !true;
                $parms[] = $param;
                $param = '';
            }
        }
        //
        return $parms;
    }
1297815
private function loadAndParseRoute($route)
    {
         // Get meta into view structure
         $meta = $this->getMetaForRoute($route);
         unset($meta["__toc__"]);
         unset($meta["views"]);

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

        // Merge frontmatter with meta
        // then merge frontmatter base into views main
        $filtered->frontmatter = array_merge_recursive_distinct(
            $meta,
            $filtered->frontmatter
        );

        // Do phase 2 processing to get new filtered content
        // (and updated frontmatter)
        $this->processContentPhaseTwo($filtered);

        // Create complete frontmatter, inluding content
        $filtered->frontmatter["data"]["content"] = isset($filtered->text)
            ? $filtered->text
            : null;

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

        return $view["main"];
    }
861316
protected static function getAssetContentsByRoute($route)
    {
        $result = null;
        try {
            $app = Application::getFacadeApplication();
            $router = $app->make(RouterInterface::class);
            $context = new RequestContext();
            $context->fromRequest($app->make(Request::class));
            $context->setMethod('GET');
            $matched = $router->getRouteByPath($route, $context);
            $controller = $matched->getAction();
            $callable = null;
            if (is_string($controller)) {
                $chunks = explode('::', $controller, 2);
                if (count($chunks) === 2) {
                    if (class_exists($chunks[0])) {
                        $array = [$app->make($chunks[0]), $chunks[1]];
                        if (is_callable($array)) {
                            $callable = $array;
                        }
                    }
                } else {
                    if (class_exists($controller) && method_exists($controller, '__invoke')) {
                        $callable = $app->make($controller);
                    }
                }
            } elseif (is_callable($controller)) {
                $callable = $controller;
            }
            if ($callable !== null) {
                ob_start();
                $r = call_user_func($callable, false);
                if ($r instanceof Response) {
                    $result = $r->getContent();
                } elseif ($r !== false) {
                    $result = ob_get_contents();
                }
                ob_end_clean();
            }
        } catch (Exception $x) {
        }

        return $result;
    }
724972
private function _setParamsToRoute($route, $params)
    {
        foreach ($params as $key => $value)
        {
            $route = preg_replace('/\{' . $key . '\}/', $value, $route);
        }

        return $route;
    }
1223510
private function getRouteName($route)
    {
        if (is_string($route)) {
            return $route;
        }

        if (is_array($route)) {
            return $route['name'];
        }

        if ($name = $route->current()->getName()) {
            return $name;
        }

        $action = $route->current()->getAction();

        if ($name = isset($action['as']) ? $action['as'] : null) {
            return $name;
        }

        return '/'.$route->current()->uri();
    }
842230
public function gatherRouteMiddlewares($route)
    {
        if (method_exists($this->router, 'gatherRouteMiddleware')) {
            return $this->router->gatherRouteMiddleware($route);
        }

        return $this->router->gatherRouteMiddlewares($route);
    }
161976
protected function getRouteInformation(Route $route)
	{
		$uri = head($route->methods()).' '.$route->uri();

		return $this->filterRoute(array(
			'host'   => $route->domain(),
			'uri'    => $uri,
			'name'   => $route->getName(),
			'action' => $route->getActionName(),
			'before' => $this->getBeforeFilters($route),
			'after'  => $this->getAfterFilters($route)
		));
	}
1325508
public function baseRoute($route)
    {
        if(strpos($route, '@') === 0) {
            $route = substr($route, 1, strlen($route)-1);
        } else {
            $baseRoute = $this->route->getParentRouteName();
            $route		= $baseRoute ? $baseRoute.'.'.$route : $route;
        }

        return $route;
    }
620009
public function toRoute($route)
	{
		if ($this->caller != null)
			$this->disableRender[] = $this->caller->identifier;
		$r = $this->router->getRoute($route);
		if ($r != null) {
			$this->currentRoute = $r;
			try {
				$this->execute();
			} catch (\Exception $e) {
				Logger::Log('log/error.txt', $e->getMessage());
				\decoy\base\ErrorController::$errors[] = $e->getMessage();
				$this->toRoute('error_page');
			}
		}
		$this->caller = null;
	}
1256773
public function extractRoutePath(string $route)
    {
        $url = (strpos($route, '/') === false) ? url($route) : $route;
        $this->router->handle($url);

        return $this->router->getMatchedRoute()->getPaths();
    }
905548
private function parseRouteConfiguration($route)
    {
        if (!is_array($route)) {
            throw new Exception("Strata configuration file contains an invalid route.");
        }

        return $this->isDynamic($route) ?
            $this->parseDynamicRoute($route) :
            $this->parseMatchedRoute($route);
    }
560396
public function map($route, $handler)
    {
        $this->_routes[] = ['/'.$route, $handler];

        if ($handler) {
            $this->_handlers[$handler][] = '/'.$route;
        }
    }
1220309
public function isMatchToRoute(Route $route, string $area = null)
    {
        $areaPart = $area ? $area . '.' : '';

        return Str::is($areaPart . $this->getRouteName(), $route->getName());
    }
715505
public function offsetGet($route){
    $return_value = null;
    if(isset($this->routes[$route])){
      $return_value = $routes[$route];
    }

    return $return_value;
  }
246509
public function map(Route $route)
    {
        $this->routes[$route->init()->getRule()] = $route;

        return $this;
    }
1341147
public function getPermFromRoute($route) {
    $menu_info = Config::get($this->config_path);

    foreach ($menu_info as $menu) {
      if ($menu[$this->route_variable_index] == $route) {
        return $menu[$this->pemissions_variable_index];
      }
    }
  }