MercureException::mercureNotConfigured()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 10
rs 10
c 1
b 0
f 0
ccs 7
cts 7
cp 1
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\Rest\Exception;
6
7
use Fig\Http\Message\StatusCodeInterface;
8
use Mezzio\ProblemDetails\Exception\CommonProblemDetailsExceptionTrait;
9
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;
10
use Throwable;
11
12
class MercureException extends RuntimeException implements ProblemDetailsExceptionInterface
13
{
14
    use CommonProblemDetailsExceptionTrait;
15
16
    private const TITLE = 'Mercure integration not configured';
17
    private const TYPE = 'MERCURE_NOT_CONFIGURED';
18
19 4
    public static function mercureNotConfigured(?Throwable $prev = null): self
20
    {
21 4
        $e = new self('This Shlink instance is not integrated with a mercure hub.', 1, $prev);
22
23 4
        $e->detail = $e->getMessage();
24 4
        $e->title = self::TITLE;
25 4
        $e->type = self::TYPE;
26 4
        $e->status = StatusCodeInterface::STATUS_NOT_IMPLEMENTED;
27
28 4
        return $e;
29
    }
30
}
31