MercureException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 10
dl 0
loc 17
rs 10
c 1
b 0
f 0
ccs 7
cts 7
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A mercureNotConfigured() 0 10 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