Conditions | 4 |
Paths | 8 |
Total Lines | 25 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
39 | public function respond( |
||
40 | array $data, |
||
41 | $total = null, |
||
42 | $page = null, |
||
43 | $per_page = null, |
||
44 | $status = 200, |
||
45 | $headers = [], |
||
46 | $options = 0 |
||
47 | ) { |
||
48 | $response = [ |
||
49 | 'status' => $status, |
||
50 | ]; |
||
51 | if (!is_null($total)) { |
||
52 | $response['total'] = $total; |
||
53 | } |
||
54 | if (!is_null($page)) { |
||
55 | $response['page'] = $page; |
||
56 | } |
||
57 | if (!is_null($per_page)) { |
||
58 | $response['per_page'] = $per_page; |
||
59 | } |
||
60 | $response['data'] = $data; |
||
61 | |||
62 | return $this->responder->respond($response, $status, $headers, $options); |
||
|
|||
63 | } |
||
64 | } |
||
65 |