diff --git a/system/HTTP/URI.php b/system/HTTP/URI.php index 6b01c79b6126..fcc90a2391ca 100644 --- a/system/HTTP/URI.php +++ b/system/HTTP/URI.php @@ -491,6 +491,20 @@ public function getPath(): string return $this->path ?? ''; } + /** + * Returns the URI path relative to baseURL. + * + * @return string The Route path. + */ + public function getRoutePath(): string + { + if ($this->routePath === null) { + throw new BadMethodCallException('The $routePath is not set.'); + } + + return $this->routePath; + } + /** * Retrieve the query string */