Total Complexity | 4 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class PaystackApiException extends PaystackException |
||
11 | { |
||
12 | protected ?string $endpoint = null; |
||
13 | |||
14 | /** @var array<string, mixed>|null */ |
||
15 | protected ?array $response = null; |
||
16 | |||
17 | /** |
||
18 | * @param array<string, mixed>|null $response |
||
19 | */ |
||
20 | public function __construct( |
||
21 | string $message = '', |
||
22 | int $code = 0, |
||
23 | ?string $endpoint = null, |
||
24 | ?array $response = null, |
||
25 | ?Exception $previous = null |
||
26 | ) { |
||
27 | parent::__construct($message, $code, $previous); |
||
28 | $this->endpoint = $endpoint; |
||
29 | $this->response = $response; |
||
30 | } |
||
31 | |||
32 | public function getEndpoint(): ?string |
||
33 | { |
||
34 | return $this->endpoint; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return array<string, mixed>|null |
||
39 | */ |
||
40 | public function getResponse(): ?array |
||
41 | { |
||
42 | return $this->response; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param array<string, mixed> $response |
||
47 | */ |
||
48 | public static function fromResponse(array $response, string $endpoint): self |
||
54 | } |
||
55 | } |
||
56 |