1 | <?php |
||
7 | class ApiResponse |
||
|
|||
8 | { |
||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | private $data; |
||
13 | |||
14 | /** |
||
15 | * @var bool |
||
16 | */ |
||
17 | private $status; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | private $responseCode; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $message; |
||
28 | |||
29 | private function __construct($data, $status, $responseCode, $message) |
||
36 | |||
37 | /** |
||
38 | * setup, build and return the response. |
||
39 | * |
||
40 | * @param array $data An array of returned data |
||
41 | * @param int $status true or false for the operation status |
||
42 | * @param int $responseCode the Http response code |
||
43 | * @param string $message response message |
||
44 | * |
||
45 | * @return \Illuminate\Http\Response |
||
46 | */ |
||
47 | public static function send($data, $status = true, $responseCode = ResponseCode::HTTP_OK, string $message = '') |
||
51 | |||
52 | /** |
||
53 | * build the response. |
||
54 | * |
||
55 | * @return \Illuminate\Http\Response |
||
56 | */ |
||
57 | private function buildResponse() |
||
66 | } |
||
67 |