| Conditions | 3 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 69 | 4 | public function convert($records) |
|
| 70 | { |
||
| 71 | 4 | $records = $this->convertToUtf8($this->filterIterable($records, __METHOD__)); |
|
| 72 | 4 | if (!is_array($records)) { |
|
| 73 | 4 | $records = iterator_to_array($records); |
|
| 74 | } |
||
| 75 | |||
| 76 | 4 | $json = @json_encode($records, $this->options, $this->depth); |
|
| 77 | 4 | if (JSON_ERROR_NONE === json_last_error()) { |
|
| 78 | 2 | return $json; |
|
| 79 | } |
||
| 80 | |||
| 81 | 2 | throw new RuntimeException(json_last_error_msg()); |
|
| 82 | } |
||
| 83 | } |
||
| 84 |