AbstractMailchimpService.php
5 months ago
MailchimpNotFoundException.php
5 months ago
MailchimpRequestException.php
5 months ago
StarterMailchimpService.php
5 months ago
MailchimpRequestException.php
49 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Infrastructure\Services\Mailchimp; |
| 4 | |
| 5 | use RuntimeException; |
| 6 | |
| 7 | class MailchimpRequestException extends RuntimeException |
| 8 | { |
| 9 | private string $endpoint; |
| 10 | private string $method; |
| 11 | private int $status; |
| 12 | private ?string $responseBody; |
| 13 | |
| 14 | public function __construct( |
| 15 | string $message, |
| 16 | string $endpoint, |
| 17 | string $method, |
| 18 | int $status = 0, |
| 19 | ?string $responseBody = null, |
| 20 | ?\Throwable $previous = null |
| 21 | ) { |
| 22 | parent::__construct($message, 0, $previous); |
| 23 | $this->endpoint = $endpoint; |
| 24 | $this->method = $method; |
| 25 | $this->status = $status; |
| 26 | $this->responseBody = $responseBody; |
| 27 | } |
| 28 | |
| 29 | public function getEndpoint(): string |
| 30 | { |
| 31 | return $this->endpoint; |
| 32 | } |
| 33 | |
| 34 | public function getMethod(): string |
| 35 | { |
| 36 | return $this->method; |
| 37 | } |
| 38 | |
| 39 | public function getStatus(): int |
| 40 | { |
| 41 | return $this->status; |
| 42 | } |
| 43 | |
| 44 | public function getResponseBody(): ?string |
| 45 | { |
| 46 | return $this->responseBody; |
| 47 | } |
| 48 | } |
| 49 |