Conditions | 8 |
Paths | 16 |
Total Lines | 25 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 8.512 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 1 | public function send($applyCallback = false) { |
|
24 | 1 | $return = []; |
|
25 | 1 | $return['success'] = $this->success; |
|
26 | 1 | if ($this->success) { |
|
27 | 1 | $return['content'] = $this->content; |
|
28 | 1 | $return['successMsg'] = $this->successMsg; |
|
29 | } else { |
||
30 | $return['error'] = $this->content; |
||
31 | 1 | } |
|
32 | if (!headers_sent()) { |
||
33 | header('Content-type: application/json'); |
||
34 | 1 | } |
|
35 | 1 | $return['commands'] = $this->commands; |
|
36 | 1 | $return['scripts'] = \App::$cur->view->getScripts(); |
|
37 | 1 | if ($applyCallback && !empty($_GET['callback'])) { |
|
38 | 1 | echo $_GET['callback'] . '('; |
|
39 | } |
||
40 | echo json_encode($return, $this->asObject ? JSON_FORCE_OBJECT : null); |
||
41 | if ($applyCallback && !empty($_GET['callback'])) { |
||
42 | echo ')'; |
||
43 | } |
||
44 | |||
45 | \Inji::$inst->stop(); |
||
46 | return true; |
||
47 | } |
||
48 | } |