Conditions | 3 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
40 | private function getJsonErrorMsg(string $json): ParsingException |
||
41 | { |
||
42 | $result = (new JsonParser())->lint($json); |
||
43 | if (defined('JSON_ERROR_UTF8') && json_last_error() === JSON_ERROR_UTF8) { |
||
44 | throw new UnexpectedValueException('"' . $json . '" is not UTF-8, could not parse as JSON'); |
||
45 | } |
||
46 | |||
47 | assert($result instanceof ParsingException); |
||
48 | |||
49 | return new ParsingException($result->getMessage(), $result->getDetails()); |
||
50 | } |
||
52 |