Gets the route for the page based on the route headers if available, else from
the parents route and the current Page's slug.

@param  string $var Set new default route.

@return string  The route for the Page.
439536
public function route($var = null)
    {
        if ($var !== null) {
            $this->route = $var;
        }

        if (empty($this->route)) {
            $baseRoute = null;

            // calculate route based on parent slugs
            $parent = $this->parent();
            if (isset($parent)) {
                if ($this->hide_home_route && $parent->route() === $this->home_route) {
                    $baseRoute = '';
                } else {
                    $baseRoute = (string)$parent->route();
                }
            }

            $this->route = isset($baseRoute) ? $baseRoute . '/' . $this->slug() : null;

            if (!empty($this->routes) && isset($this->routes['default'])) {
                $this->routes['aliases'][] = $this->route;
                $this->route = $this->routes['default'];

                return $this->route;
            }
        }

        return $this->route;
    }
822976
public function post($var = null)
	{
		$this->id = 0;
		if (!empty($var)) {
			$routing = explode('/', $var);
			if (is_array($routing)) {
				$var = array_shift($routing);
				$this->id = empty($routing)
					? 0
					: array_shift($routing);
			} else {
				$var = $routing;
			}

			if ($this->checkAuth()) {
				// load action based off of naming conventions
				header('Content-Type: application/json');
				return $this->_autoaction($var, 'post');
			} else {
				return $this->getForbbiden($var);
			}
		} else {
			return $this->getNoop();
		}
	}
39855
public function expires($var = null)
    {
        if ($var !== null) {
            $this->expires = $var;
        }

        return $this->expires ?? Grav::instance()['config']->get('system.pages.expires');
    }
295055
public function getRoutesPath($basePath = null)
    {
        $routes = $this->get('routes');
        if (empty($routes)) {
            // Fallback to default
            return $basePath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'routes' . DIRECTORY_SEPARATOR . 'main.php';
        }

        return $basePath . DIRECTORY_SEPARATOR . $routes['base_dir'] . DIRECTORY_SEPARATOR . $routes['base_file'];
    }
1233479
public function getRouteMatch()
    {
        if (null === $this->routeMatch) {
            /** @noinspection PhpUndefinedMethodInspection */
            $this->routeMatch = $this->getEvent()->getRouteMatch();
        }

        return $this->routeMatch;
    }
753563
public function raw($var = null)
    {
        if ($var !== null) {
            $this->raw = (string) $var;
            $this->content = null;
        }

        if (!\is_string($this->raw)) {
            $this->raw = $this->load();
        }

        return $this->raw;
    }
1085011
private function getDefaultRoutePath(): string
    {
        $pattern = $this
            ->adminConfiguration
            ->getParameter('routing_url_pattern')
        ;
        $path = str_replace('{admin}', $this->adminName, $pattern);
        $path = str_replace('{action}', $this->actionName, $path);

        if (in_array($this->actionName, ['edit', 'delete'])) {
            $path .= '/{id}';
        }

        return $path;
    }
1256773
public function extractRoutePath(string $route)
    {
        $url = (strpos($route, '/') === false) ? url($route) : $route;
        $this->router->handle($url);

        return $this->router->getMatchedRoute()->getPaths();
    }
911962
public function getRoutePath($url = "") {
        if (isset($_SERVER['REDIRECT_QUERY_STRING']) && empty($url)) {
            $url = $_SERVER['REDIRECT_QUERY_STRING'];
        }
        if (isset($_SERVER['REQUEST_URI']) && empty($url)) {
            $url = $_SERVER['REQUEST_URI'];
        }
        if (isset($_SERVER['PATH_INFO']) && empty($url)) {
            $url = $_SERVER['PATH_INFO'];
        }
        return explode('/', trim($url, '/'));
    }
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;
    }
175535
public function getParam($var = null)
    {
        $param = $this->_parameters;
        if (null !== $var) {
            if (isset($this->_parameters[$var])) {
                $param = $this->_parameters[$var];
            } else {
                $param = null;
            }
        }

        return $param;
    }
768678
public function getRoute(): ?RouteInterface
    {
        if (!is_null($this->getApp())) {
            return $this->getApp()->getService('routing')->getCurrentRoute();
        }

        return null;
    }
984639
protected Object lookupWalkForVar(String var) {
		JsonNode current = node;
		while (current!=null) {
			Object result = lookupVar(current, var);
			if (result!=null) return result;
			
			if (current.hasAttribute("inheritProperties")) {
				current = current.getParent();				
			} else {
				current = null;
			}
		}
		return lookupVar(node, var);
	}
883057
protected function getArticleRouterPath($routeName, $type, $slug, $tagOrCategory, $locale, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
    {
        if (!$this->articleRouteExists($type, $locale)) {
            $routeName = '_slug';
        }
        if (!isset($parameters[$type])) {
            $parameters[$type] = $tagOrCategory;
        }
        if (!isset($parameters['url'])) {
            $parameters['url'] = $slug;
        }
        if (!isset($parameters['_locale'])) {
            $parameters['_locale'] = $locale;
        }

        return $this->router->generate($routeName, $parameters, $referenceType);
    }
1027753
public function get($var)
    {
        $node = $this->mainNode->getByKey($var);
        if (empty($node)) return null;

        return $node->getData();
    }
90409
public static function getCurrentPage($varPage = 'page', $default = 1)
    {
        $page = isset($_REQUEST[$varPage]) ? $_REQUEST[$varPage] : 1;

        if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) {
            return $page;
        }

        return $default;
    }
626504
public function route($key, $default = null)
    {
        if (isset($this->routeParams[$key])){
            return $this->routeParams[$key];
        }
        return $default;
    }