ResponseBuilders
1 month ago
v1
1 month ago
API.php
2 months ago
Endpoint.php
1 year ago
Error.php
2 months ago
ErrorHandler.php
1 year ago
ErrorResponse.php
3 years ago
Response.php
2 months ago
SuccessResponse.php
3 years ago
index.php
3 years ago
SuccessResponse.php
28 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\API\JSON; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | class SuccessResponse extends Response { |
| 9 | public $data; |
| 10 | |
| 11 | public function __construct( |
| 12 | $data = [], |
| 13 | $meta = [], |
| 14 | $status = self::STATUS_OK |
| 15 | ) { |
| 16 | parent::__construct($status, $meta); |
| 17 | $this->data = $data; |
| 18 | } |
| 19 | |
| 20 | public function getData() { |
| 21 | if ($this->data === null) return []; |
| 22 | |
| 23 | return [ |
| 24 | 'data' => $this->data, |
| 25 | ]; |
| 26 | } |
| 27 | } |
| 28 |