Total Complexity | 4 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
12 | trait ResponseTrait |
||
13 | { |
||
14 | /** |
||
15 | * Returns success response. |
||
16 | * |
||
17 | * @param string $message |
||
18 | * @param array|null $data |
||
19 | * |
||
20 | * @return array |
||
21 | */ |
||
22 | protected function getSuccessResponse(string $message, array $data = null): array |
||
23 | { |
||
24 | return $this->getStatusResponse($message, 'success', $data); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Returns fail response. |
||
29 | * |
||
30 | * @param string $message |
||
31 | * @param array|null $data |
||
32 | * |
||
33 | * @return array |
||
34 | */ |
||
35 | protected function getFailResponse(string $message, array $data = null): array |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Returns status, message and code. |
||
42 | * |
||
43 | * @param string $message |
||
44 | * @param string $status |
||
45 | * @param int $statusCode |
||
46 | * @param array|null $data |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | protected function getStatusResponse( |
||
71 |