Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
24 | 10 | public function format($errorCode = null, string $message = null, array $data = null): array |
|
25 | { |
||
26 | $response = [ |
||
27 | 'error' => [ |
||
28 | 10 | 'code' => $errorCode, |
|
29 | 10 | 'message' => $message, |
|
30 | ], |
||
31 | ]; |
||
32 | |||
33 | 10 | if (is_array($data)) { |
|
34 | 1 | $response['error'] = array_merge($response['error'], $data); |
|
35 | } |
||
36 | |||
37 | 10 | return $response; |
|
38 | } |
||
39 | } |
||
40 |