Optimisations

This commit is contained in:
Simon Sessingø
2021-04-01 03:11:05 +02:00
parent 52c6c226c0
commit b94dc4355f
2 changed files with 6 additions and 7 deletions
+4 -5
View File
@@ -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;