| @@ -1,0 +1,33 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +declare(strict_types=1); | |
| 4 | + | |
| 5 | +namespace Metricool\Exceptions; | |
| 6 | + | |
| 7 | +class ApiException extends \Exception | |
| 8 | +{ | |
| 9 | + protected array $data = []; | |
| 10 | + protected int $statusCode = 400; | |
| 11 | + | |
| 12 | + public function setResponseCode(int $code): ApiException | |
| 13 | + { | |
| 14 | + $this->statusCode = $code; | |
| 15 | + return $this; | |
| 16 | + } | |
| 17 | + | |
| 18 | + public function getResponseCode(): int | |
| 19 | + { | |
| 20 | + return $this->statusCode; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public function setData(array $data): ApiException | |
| 24 | + { | |
| 25 | + $this->data = $data; | |
| 26 | + return $this; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public function getData(): array | |
| 30 | + { | |
| 31 | + return $this->data; | |
| 32 | + } | |
| 33 | +} | |