Passed
Push — master ( 08894b...cd03f9 )
by Joachim
06:58
created

ApiException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getErrorCode() 0 3 1
A getErrorMessage() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\DAO\Exception;
6
7
use Psr\Http\Message\RequestInterface;
8
use Psr\Http\Message\ResponseInterface;
9
10
final class ApiException extends RequestException
11
{
12
    /**
13
     * @var int|null
14
     */
15
    private $errorCode;
16
17
    /**
18
     * @var string|null
19
     */
20
    private $errorMessage;
21
22
    public function __construct(RequestInterface $request, ResponseInterface $response, int $statusCode, int $errorCode, string $errorMessage)
23
    {
24
        $this->errorCode = $errorCode;
25
        $this->errorMessage = $errorMessage;
26
27
        parent::__construct($request, $response, $statusCode);
28
    }
29
30
    public function getErrorCode(): ?int
31
    {
32
        return $this->errorCode;
33
    }
34
35
    public function getErrorMessage(): ?string
36
    {
37
        return $this->errorMessage;
38
    }
39
}
40