HttpException   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 14
c 2
b 0
f 0
dl 0
loc 42
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getErrors() 0 3 1
A __construct() 0 15 1
A getStatusCode() 0 3 1
A getStatusMessage() 0 3 1
A getResponse() 0 3 1
1
<?php
2
3
namespace Ipag\Sdk\Exception;
4
5
use Ipag\Sdk\Http\Response;
6
use Throwable;
7
8
abstract class HttpException extends BaseException
9
{
10
    protected ?Response $response;
11
    protected ?int $statusCode;
12
    protected ?string $statusMessage;
13
    protected ?array $errors;
14
15
    public function __construct(
16
        string $message = '',
17
        int $code = 0,
18
        ?Throwable $previous = null,
19
        ?Response $response = null,
20
        ?int $statusCode = null,
21
        ?string $statusMessage = null,
22
        ?array $errors = []
23
    ) {
24
        parent::__construct($message, $code, $previous);
25
26
        $this->response = $response;
27
        $this->statusCode = $statusCode;
28
        $this->statusMessage = $statusMessage;
29
        $this->errors = $errors;
30
    }
31
32
    public function getResponse(): ?Response
33
    {
34
        return $this->response;
35
    }
36
37
    public function getStatusCode(): ?int
38
    {
39
        return $this->statusCode;
40
    }
41
42
    public function getStatusMessage(): ?string
43
    {
44
        return $this->statusMessage;
45
    }
46
47
    public function getErrors(): ?array
48
    {
49
        return $this->errors;
50
    }
51
}