API.php
6 months ago
AbstractListingEndpoint.php
3 weeks ago
ApiException.php
2 months ago
Endpoint.php
3 months ago
EndpointContainer.php
3 years ago
ErrorResponse.php
3 years ago
Exception.php
3 years ago
ListingRequestValidationTrait.php
1 month ago
Request.php
3 years ago
Response.php
1 year ago
index.php
3 years ago
ErrorResponse.php
26 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\API\REST; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | class ErrorResponse extends Response { |
| 9 | public function __construct( |
| 10 | int $status, |
| 11 | string $message, |
| 12 | string $code, |
| 13 | array $errors = [] |
| 14 | ) { |
| 15 | parent::__construct(null, $status); |
| 16 | $this->set_data([ |
| 17 | 'code' => $code, |
| 18 | 'message' => $message, |
| 19 | 'data' => [ |
| 20 | 'status' => $status, |
| 21 | 'errors' => $errors, |
| 22 | ], |
| 23 | ]); |
| 24 | } |
| 25 | } |
| 26 |