Handler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 16
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

1 Method

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