|
|
@ -215,21 +215,27 @@ class JsonFile
|
|
|
|
return $result;
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Throws an exception according to a given code with a customized message
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param int $code return code of json_last_error function
|
|
|
|
|
|
|
|
* @throws \RuntimeException
|
|
|
|
|
|
|
|
*/
|
|
|
|
private static function throwEncodeError($code)
|
|
|
|
private static function throwEncodeError($code)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch ($code) {
|
|
|
|
switch ($code) {
|
|
|
|
case JSON_ERROR_DEPTH:
|
|
|
|
case JSON_ERROR_DEPTH:
|
|
|
|
$msg = 'Maximum stack depth exceeded';
|
|
|
|
$msg = 'Maximum stack depth exceeded';
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case JSON_ERROR_STATE_MISMATCH:
|
|
|
|
case JSON_ERROR_STATE_MISMATCH:
|
|
|
|
$msg = 'Underflow or the modes mismatch';
|
|
|
|
$msg = 'Underflow or the modes mismatch';
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case JSON_ERROR_CTRL_CHAR:
|
|
|
|
case JSON_ERROR_CTRL_CHAR:
|
|
|
|
$msg = 'Unexpected control character found';
|
|
|
|
$msg = 'Unexpected control character found';
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case JSON_ERROR_UTF8:
|
|
|
|
case JSON_ERROR_UTF8:
|
|
|
|
$msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
|
|
|
|
$msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
$msg = 'Unknown error';
|
|
|
|
$msg = 'Unknown error';
|
|
|
|
}
|
|
|
|
}
|
|
|
|