| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function jsonSerialize() |
||
| 16 | { |
||
| 17 | $contents = (string) $this->getContents(); |
||
| 18 | if ($contents === '') { |
||
| 19 | return null; |
||
| 20 | } |
||
| 21 | |||
| 22 | $decodedContents = json_decode($contents, true); |
||
| 23 | if (json_last_error() !== JSON_ERROR_NONE) { |
||
| 24 | throw new RuntimeException('Error trying to decode response: ' . json_last_error_msg()); |
||
| 25 | } |
||
| 26 | |||
| 27 | return $decodedContents; |
||
| 28 | } |
||
| 29 | } |
||
| 30 |