1234567891011121314151617181920212223242526272829303132 |
- <?php
- declare(strict_types=1);
- namespace Shlinkio\Shlink\Core\Exception;
- use Fig\Http\Message\StatusCodeInterface;
- use Mezzio\ProblemDetails\Exception\CommonProblemDetailsExceptionTrait;
- use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;
- use function sprintf;
- class TagNotFoundException extends DomainException implements ProblemDetailsExceptionInterface
- {
- use CommonProblemDetailsExceptionTrait;
- private const TITLE = 'Tag not found';
- private const TYPE = 'TAG_NOT_FOUND';
- public static function fromTag(string $tag): self
- {
- $e = new self(sprintf('Tag with name "%s" could not be found', $tag));
- $e->detail = $e->getMessage();
- $e->title = self::TITLE;
- $e->type = self::TYPE;
- $e->status = StatusCodeInterface::STATUS_NOT_FOUND;
- $e->additional = ['tag' => $tag];
- return $e;
- }
- }
|