src/Decoder.php 1 location
|
@@ 213-219 (lines=7) @@
|
210 |
|
} |
211 |
|
// @codeCoverageIgnoreEnd |
212 |
|
|
213 |
|
if (\json_last_error() !== \JSON_ERROR_NONE) { |
214 |
|
if (function_exists('\json_last_error_msg')) { |
215 |
|
throw new NativeJsonErrorException(\json_last_error_msg(), \json_last_error()); |
216 |
|
} else { |
217 |
|
throw new NativeJsonErrorException('An error occurred while decoding JSON.', \json_last_error()); |
218 |
|
} |
219 |
|
} |
220 |
|
|
221 |
|
return $data; |
222 |
|
} |
src/Encoder.php 1 location
|
@@ 111-117 (lines=7) @@
|
108 |
|
} |
109 |
|
// @codeCoverageIgnoreEnd |
110 |
|
|
111 |
|
if ($json === false) { |
112 |
|
if (function_exists('\json_last_error_msg')) { |
113 |
|
throw new NativeJsonErrorException(\json_last_error_msg(), \json_last_error()); |
114 |
|
} else { |
115 |
|
throw new NativeJsonErrorException('An error occurred while encoding JSON.', \json_last_error()); |
116 |
|
} |
117 |
|
} |
118 |
|
|
119 |
|
// Convert |
120 |
|
if ($toEncoding !== self::UTF8) { |