mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
32 lines
951 B
PHP
32 lines
951 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Shlinkio\Shlink\Rest\Exception;
|
|
|
|
use Fig\Http\Message\StatusCodeInterface;
|
|
use Mezzio\ProblemDetails\Exception\CommonProblemDetailsExceptionTrait;
|
|
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;
|
|
|
|
use function Shlinkio\Shlink\Core\toProblemDetailsType;
|
|
|
|
class MercureException extends RuntimeException implements ProblemDetailsExceptionInterface
|
|
{
|
|
use CommonProblemDetailsExceptionTrait;
|
|
|
|
private const TITLE = 'Mercure integration not configured';
|
|
public const ERROR_CODE = 'mercure-not-configured';
|
|
|
|
public static function mercureNotConfigured(): self
|
|
{
|
|
$e = new self('This Shlink instance is not integrated with a mercure hub.');
|
|
|
|
$e->detail = $e->getMessage();
|
|
$e->title = self::TITLE;
|
|
$e->type = toProblemDetailsType(self::ERROR_CODE);
|
|
$e->status = StatusCodeInterface::STATUS_NOT_IMPLEMENTED;
|
|
|
|
return $e;
|
|
}
|
|
}
|