mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Added more tests for new logics
This commit is contained in:
@@ -6,24 +6,13 @@ namespace Shlinkio\Shlink\Core\Exception;
|
||||
|
||||
class ShortCodeCannotBeRegeneratedException extends RuntimeException
|
||||
{
|
||||
/** @var @bool */
|
||||
private $reasonIsSlug = false;
|
||||
|
||||
public static function forShortUrlWithCustomSlug(): self
|
||||
{
|
||||
$e = new self('The short code cannot be regenerated on ShortUrls where a custom slug was provided.');
|
||||
$e->reasonIsSlug = true;
|
||||
|
||||
return $e;
|
||||
return new self('The short code cannot be regenerated on ShortUrls where a custom slug was provided.');
|
||||
}
|
||||
|
||||
public static function forShortUrlAlreadyPersisted(): self
|
||||
{
|
||||
return new self('The short code can be regenerated only on new ShortUrls which have not been persisted yet.');
|
||||
}
|
||||
|
||||
public function reasonIsSlug(): bool
|
||||
{
|
||||
return $this->reasonIsSlug;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user