Fixed merge conflicts

This commit is contained in:
Alejandro Celaya
2019-12-06 23:34:50 +01:00
13 changed files with 170 additions and 29 deletions

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Exception;
use Fig\Http\Message\StatusCodeInterface;
use Zend\ProblemDetails\Exception\CommonProblemDetailsExceptionTrait;
use Zend\ProblemDetails\Exception\ProblemDetailsExceptionInterface;
use function sprintf;
class TagConflictException extends RuntimeException implements ProblemDetailsExceptionInterface
{
use CommonProblemDetailsExceptionTrait;
private const TITLE = 'Tag conflict';
private const TYPE = 'TAG_CONFLICT';
public static function fromExistingTag(string $oldName, string $newName): self
{
$e = new self(sprintf('You cannot rename tag %s to %s, because it already exists', $oldName, $newName));
$e->detail = $e->getMessage();
$e->title = self::TITLE;
$e->type = self::TYPE;
$e->status = StatusCodeInterface::STATUS_CONFLICT;
$e->additional = [
'oldName' => $oldName,
'newName' => $newName,
];
return $e;
}
}