VerifyAuthenticationException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 14
rs 10
ccs 7
cts 7
cp 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A forInvalidApiKey() 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
11
class VerifyAuthenticationException extends RuntimeException implements ProblemDetailsExceptionInterface
12
{
13
    use CommonProblemDetailsExceptionTrait;
14
15 3
    public static function forInvalidApiKey(): self
16
    {
17 3
        $e = new self('Provided API key does not exist or is invalid.');
18
19 3
        $e->detail = $e->getMessage();
20 3
        $e->title = 'Invalid API key';
21 3
        $e->type = 'INVALID_API_KEY';
22 3
        $e->status = StatusCodeInterface::STATUS_UNAUTHORIZED;
23
24 3
        return $e;
25
    }
26
}
27