mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 08:56:42 -06:00
24 lines
525 B
PHP
24 lines
525 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace ShlinkioApiTest\Shlink\Rest\Utils;
|
|
|
|
use GuzzleHttp\Psr7\Query;
|
|
use Laminas\Diactoros\Uri;
|
|
|
|
use function sprintf;
|
|
|
|
class UrlBuilder
|
|
{
|
|
public static function buildShortUrlPath(string $shortCode, ?string $domain, string $suffix = ''): string
|
|
{
|
|
$url = new Uri(sprintf('/short-urls/%s%s', $shortCode, $suffix));
|
|
if ($domain !== null) {
|
|
$url = $url->withQuery(Query::build(['domain' => $domain]));
|
|
}
|
|
|
|
return $url->__toString();
|
|
}
|
|
}
|