Skip to content

Commit 4fb46af

Browse files
committed
feat: add URI::getRoutePath()
1 parent 6f1e5ea commit 4fb46af

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

system/HTTP/URI.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,20 @@ public function getPath(): string
491491
return $this->path ?? '';
492492
}
493493

494+
/**
495+
* Returns the URI path relative to baseURL.
496+
*
497+
* @return string The Route path.
498+
*/
499+
public function getRoutePath(): string
500+
{
501+
if ($this->routePath === null) {
502+
throw new BadMethodCallException('The $routePath is not set.');
503+
}
504+
505+
return $this->routePath;
506+
}
507+
494508
/**
495509
* Retrieve the query string
496510
*/

0 commit comments

Comments
 (0)