| 1 | <?php |
||
| 7 | abstract class AbstractPayload |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The payload data. |
||
| 11 | * |
||
| 12 | * @var mixed|null |
||
| 13 | */ |
||
| 14 | protected $data = null; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The payload status code. |
||
| 18 | * |
||
| 19 | * @var int |
||
| 20 | */ |
||
| 21 | protected $status = 200; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Construct a new Payload class. |
||
| 25 | * |
||
| 26 | * @param mixed|null |
||
| 27 | */ |
||
| 28 | public function __construct($data, $status = 200) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Set the response data. |
||
| 36 | * |
||
| 37 | * @return mixed|null |
||
| 38 | */ |
||
| 39 | public function setData($data = null) |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Set the response status. |
||
| 55 | * |
||
| 56 | * @return $this |
||
| 57 | */ |
||
| 58 | public function setStatus($status = 200) |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Get the payload data. |
||
| 67 | * |
||
| 68 | * @return mixed|null |
||
| 69 | */ |
||
| 70 | public function getData() |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Get the payload status. |
||
| 77 | * |
||
| 78 | * @return int |
||
| 79 | */ |
||
| 80 | public function getStatus() |
||
| 84 | } |
||
| 85 |