shlink/module/Core/src/Exception/NonUniqueSlugException.php

21 lines
464 B
PHP
Raw Normal View History

<?php
2019-10-05 18:26:10 +03:00
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Exception;
use function sprintf;
class NonUniqueSlugException extends InvalidArgumentException
{
public static function fromSlug(string $slug, ?string $domain): self
{
$suffix = '';
if ($domain !== null) {
$suffix = sprintf(' for domain "%s"', $domain);
}
return new self(sprintf('Provided slug "%s" is not unique%s.', $slug, $suffix));
}
}