Passed
Push — master ( 7cd6c5...dd963e )
by Laurens
04:05
created

Handler::handleRequestException()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Werkspot\KvkApi\Http\Adapter\Guzzle\Exception;
6
7
use GuzzleHttp\Exception\RequestException;
8
use Werkspot\KvkApi\Exception\KvkApiException;
9
10
final class Handler
11
{
12 5
    public static function handleRequestException(RequestException $exception): void
13
    {
14 5
        switch ($exception->getCode()) {
15 5
            case 404:
16 3
                throw new NotFoundException();
17
        }
18
19 2
        throw new KvkApiException($exception->getMessage());
20
    }
21
}
22