Handler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 14
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handleRequestException() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\NestApi\Http\Adapter\Guzzle\Exception;
6
7
use GuzzleHttp\Exception\RequestException;
8
use LauLamanApps\NestApi\Exception\NestApiException;
9
10
final class Handler
11
{
12
    /**
13
     * @throws NestApiException
14
     * @throws NotFoundException
15
     */
16 2
    public static function handleRequestException(RequestException $exception): void
17
    {
18 2
        switch ($exception->getCode()) {
19 2
            case 404:
20
                throw new NotFoundException();
21
        }
22
23 2
        throw new NestApiException($exception->getMessage());
24
    }
25
}
26