Conditions | 2 |
Paths | 1 |
Total Lines | 8 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
59 | public static function throwError(int $code, ?string $message = null): void |
||
60 | { |
||
61 | header('Content-Type: application/json; charset=utf-8'); |
||
62 | http_response_code($code); |
||
63 | die(json_encode([ |
||
64 | 'error' => [ |
||
65 | 'status' => $code, |
||
66 | 'message' => ($message ? $message : 'Nenhum token fornecido'), |
||
67 | ], |
||
72 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.