| Conditions | 4 |
| Paths | 5 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | protected function output($data): string |
||
| 43 | { |
||
| 44 | try { |
||
| 45 | // 返回JSON数据格式到客户端 包含状态信息 |
||
| 46 | $data = json_encode($data, $this->options['json_encode_param']); |
||
| 47 | |||
| 48 | if (false === $data) { |
||
| 49 | throw new \InvalidArgumentException(json_last_error_msg()); |
||
| 50 | } |
||
| 51 | |||
| 52 | return $data; |
||
| 53 | } catch (\Exception $e) { |
||
| 54 | if ($e->getPrevious()) { |
||
| 55 | throw $e->getPrevious(); |
||
| 56 | } |
||
| 57 | throw $e; |
||
| 58 | } |
||
| 62 |