Closed minorOffense closed 2 years ago
The URL set by the API implementer may or may not have a trailing slash. It’d be nice to handle either case smoothly.
A pattern we use relatively regularly:
$url = rtrim($this->getUrl(), '/') . '/' . $uri
Assuming $uri never has the slash. Otherwise just append directly it to the string.
https://github.com/invoiceninja/sdk-php/blob/7a644a50be2b5d24863cc03b01cdf84f62011d6d/src/InvoiceNinja.php#L192
The URL set by the API implementer may or may not have a trailing slash. It’d be nice to handle either case smoothly.
A pattern we use relatively regularly:
$url = rtrim($this->getUrl(), '/') . '/' . $uri
Assuming $uri never has the slash. Otherwise just append directly it to the string.
https://github.com/invoiceninja/sdk-php/blob/7a644a50be2b5d24863cc03b01cdf84f62011d6d/src/InvoiceNinja.php#L192