Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | public static function write($succes, $data, $httpCode = 200) |
||
37 | { |
||
38 | http_response_code($httpCode); |
||
39 | |||
40 | if ($succes) { |
||
41 | $outPut=array('success'=>'true', 'data'=>$data); |
||
42 | |||
43 | } else { |
||
44 | |||
45 | $outPut=array('success'=>'false', 'error'=>$data); |
||
46 | } |
||
47 | |||
48 | echo json_encode($outPut, JSON_UNESCAPED_UNICODE); |
||
49 | exit; |
||
|
|||
50 | } |
||
52 | } |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.