From a1ec78bf0dc93d0e05e5f066f1949dc3baecea06 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:44:51 +0200 Subject: Adding upstream version 0.20.0. Signed-off-by: Daniel Baumann --- vendor/gipfl/json/src/JsonException.php | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 vendor/gipfl/json/src/JsonException.php (limited to 'vendor/gipfl/json/src/JsonException.php') diff --git a/vendor/gipfl/json/src/JsonException.php b/vendor/gipfl/json/src/JsonException.php new file mode 100644 index 0000000..e7b5f36 --- /dev/null +++ b/vendor/gipfl/json/src/JsonException.php @@ -0,0 +1,55 @@ + 'The maximum stack depth has been exceeded', + JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded', + JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON', + JSON_ERROR_SYNTAX => 'JSON Syntax error', + JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded' + ]; + if (\array_key_exists($code, $map)) { + return $map[$code]; + } + + if (PHP_VERSION_ID >= 50500) { + $map = [ + JSON_ERROR_RECURSION => 'One or more recursive references in the value to be encoded', + JSON_ERROR_INF_OR_NAN => 'One or more NAN or INF values in the value to be encoded', + JSON_ERROR_UNSUPPORTED_TYPE => 'A value of a type that cannot be encoded was given', + ]; + if (\array_key_exists($code, $map)) { + return $map[$code]; + } + } + + if (PHP_VERSION_ID >= 70000) { + $map = [ + JSON_ERROR_INVALID_PROPERTY_NAME => 'A property name that cannot be encoded was given', + JSON_ERROR_UTF16 => 'Malformed UTF-16 characters, possibly incorrectly encoded', + ]; + + if (\array_key_exists($code, $map)) { + return $map[$code]; + } + } + + return 'An error occured when parsing a JSON string'; + } +} -- cgit v1.2.3