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