public static function jsonErrorToException($json_error_code)
    {
        switch ($json_error_code) {
            case JSON_ERROR_DEPTH:
                return JsonEncodeDecodeException::depth();

            case JSON_ERROR_STATE_MISMATCH:
                return JsonEncodeDecodeException::stateMismatch();

            case JSON_ERROR_CTRL_CHAR:
                return JsonEncodeDecodeException::ctrlChar();

            case JSON_ERROR_SYNTAX:
                return JsonEncodeDecodeException::syntax();

            case JSON_ERROR_UTF8:
                return JsonEncodeDecodeException::utf8();

            case JSON_ERROR_RECURSION:
                return JsonEncodeDecodeException::recursion();

            case JSON_ERROR_INF_OR_NAN:
                return JsonEncodeDecodeException::infOrNan();

            case JSON_ERROR_UNSUPPORTED_TYPE:
                return JsonEncodeDecodeException::unsupportedType();

            case 9: // JSON_ERROR_INVALID_PROPERTY_NAME: // Available since PHP 7.0.0
                return JsonEncodeDecodeException::invalidPropertyName();

            case 10: // JSON_ERROR_UTF16: // Available since PHP 7.0.0
                return JsonEncodeDecodeException::utf16();
        }

        return JsonEncodeDecodeException::unknown();
    }
public static function jsonErrorToException($json_error_code)
    {
        switch ($json_error_code) {
            case JSON_ERROR_DEPTH:
                return JsonEncodeDecodeException::depth();

            case JSON_ERROR_STATE_MISMATCH:
                return JsonEncodeDecodeException::stateMismatch();

            case JSON_ERROR_CTRL_CHAR:
                return JsonEncodeDecodeException::ctrlChar();

            case JSON_ERROR_SYNTAX:
                return JsonEncodeDecodeException::syntax();

            case JSON_ERROR_UTF8:
                return JsonEncodeDecodeException::utf8();

            case JSON_ERROR_RECURSION:
                return JsonEncodeDecodeException::recursion();

            case JSON_ERROR_INF_OR_NAN:
                return JsonEncodeDecodeException::infOrNan();

            case JSON_ERROR_UNSUPPORTED_TYPE:
                return JsonEncodeDecodeException::unsupportedType();

            case 9: // JSON_ERROR_INVALID_PROPERTY_NAME: // Available since PHP 7.0.0
                return JsonEncodeDecodeException::invalidPropertyName();

            case 10: // JSON_ERROR_UTF16: // Available since PHP 7.0.0
                return JsonEncodeDecodeException::utf16();
        }

        return JsonEncodeDecodeException::unknown();
    }
public static function jsonErrorToException ( $ json_error_code ) { switch ( $ json_error_code ) { case JSON_ERROR_DEPTH : return JsonEncodeDecodeException :: depth ( ) ; case JSON_ERROR_STATE_MISMATCH : return JsonEncodeDecodeException :: stateMismatch ( ) ; case JSON_ERROR_CTRL_CHAR : return JsonEncodeDecodeException :: ctrlChar ( ) ; case JSON_ERROR_SYNTAX : return JsonEncodeDecodeException :: syntax ( ) ; case JSON_ERROR_UTF8 : return JsonEncodeDecodeException :: utf8 ( ) ; case JSON_ERROR_RECURSION : return JsonEncodeDecodeException :: recursion ( ) ; case JSON_ERROR_INF_OR_NAN : return JsonEncodeDecodeException :: infOrNan ( ) ; case JSON_ERROR_UNSUPPORTED_TYPE : return JsonEncodeDecodeException :: unsupportedType ( ) ; case 9 : // JSON_ERROR_INVALID_PROPERTY_NAME: // Available since PHP 7.0.0 return JsonEncodeDecodeException :: invalidPropertyName ( ) ; case 10 : // JSON_ERROR_UTF16: // Available since PHP 7.0.0 return JsonEncodeDecodeException :: utf16 ( ) ; } return JsonEncodeDecodeException :: unknown ( ) ; }
Converts JSON decode error into exception.

@param int|null $json_error_code

@return JsonEncodeDecodeException
Converts JSON decode error into exception .