| Conditions | 3 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | #[Override] |
||
| 21 | public function render(ResourceObject $ro) |
||
| 22 | { |
||
| 23 | if (! array_key_exists('Content-Type', $ro->headers)) { |
||
| 24 | $ro->headers['Content-Type'] = 'application/json'; |
||
| 25 | } |
||
| 26 | |||
| 27 | $ro->view = (string) json_encode($ro); |
||
| 28 | $e = json_last_error(); |
||
| 29 | if ($e) { |
||
| 30 | // @codeCoverageIgnoreStart |
||
| 31 | $msg = json_last_error_msg(); |
||
| 32 | error_log('json_encode error: ' . $msg . ' in ' . __METHOD__); |
||
| 33 | |||
| 34 | return ''; |
||
| 35 | |||
| 36 | // @codeCoverageIgnoreEnd |
||
| 37 | } |
||
| 38 | |||
| 39 | return $ro->view; |
||
| 40 | } |
||
| 42 |