I don't think you need 2 different cases. You should strip the query string from the current URI in all cases and then apply the current logic:

```php
// relative path
$currentUri = $this->currentUri;
if (false !== ($pos = strpos($currentUri, '?'))) { 
    $currentUri = substr($currentUri, 0, $pos);
}

return substr($this->currentUri, 0, strrpos($currentUri, '/') + 1).$uri; 
```

It is simpler than doing 2 different cases based on an abstract distinction.