mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-08 08:13:11 +08:00
Encapsulated logic to get rid of nested ifs
This commit is contained in:
@@ -7,6 +7,7 @@ namespace Shlinkio\Shlink\Core\Exception;
|
||||
use Fig\Http\Message\StatusCodeInterface;
|
||||
use Mezzio\ProblemDetails\Exception\CommonProblemDetailsExceptionTrait;
|
||||
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;
|
||||
use Shlinkio\Shlink\Importer\Model\ImportedShlinkUrl;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
@@ -34,4 +35,9 @@ class NonUniqueSlugException extends InvalidArgumentException implements Problem
|
||||
|
||||
return $e;
|
||||
}
|
||||
|
||||
public static function fromImport(ImportedShlinkUrl $importedUrl): self
|
||||
{
|
||||
return self::fromSlug($importedUrl->shortCode(), $importedUrl->domain());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user