mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-21 12:14:53 +03:00
23 lines
525 B
PHP
23 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();
|
|
}
|
|
}
|