Merge branch 'develop' of github.com:getgrav/grav into develop

This commit is contained in:
Andy Miller
2018-03-20 10:33:32 -06:00

View File

@@ -78,13 +78,35 @@ class Route
}
/**
* @param int $offset
* @param int|null $length
* @return string
*/
public function getRoute()
public function getRoute($offset = 0, $length = null)
{
if ($offset !== 0 || $length !== null) {
return ($offset === 0 ? '/' : '') . implode('/', $this->getRouteParts($offset, $length));
}
return '/' . $this->route;
}
/**
* @param int $offset
* @param int|null $length
* @return array
*/
public function getRouteParts($offset = 0, $length = null)
{
$parts = explode('/', $this->route);
if ($offset !== 0 || $length !== null) {
$parts = array_slice($parts, $offset, $length);
}
return $parts;
}
/**
* Return array of both query and Grav parameters.
*