mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
Optimisations
This commit is contained in:
@@ -432,14 +432,13 @@ class Url implements JsonSerializable
|
||||
*/
|
||||
public function getRelativeUrl($includeParams = true): string
|
||||
{
|
||||
$path = $this->path ?? '/';
|
||||
|
||||
if($includeParams === false) {
|
||||
return rtrim($this->path, '/');
|
||||
return $path;
|
||||
}
|
||||
|
||||
$params = $this->getQueryString();
|
||||
|
||||
$path = $this->path ?? '';
|
||||
$query = $params !== '' ? '?' . $params : '';
|
||||
$query = $this->getQueryString() !== '' ? '?' . $this->getQueryString() : '';
|
||||
$fragment = $this->fragment !== null ? '#' . $this->fragment : '';
|
||||
|
||||
return $path . $query . $fragment;
|
||||
|
||||
Reference in New Issue
Block a user