class FeedsExJsonUtility in Feeds extensible parsers 7.2
Same name and namespace in other branches
- 7 src/Json/Utility.php \FeedsExJsonUtility
Various helpers for handling JSON.
Hierarchy
- class \FeedsExJsonUtility
Expanded class hierarchy of FeedsExJsonUtility
File
- src/
Json/ Utility.php, line 11 - Contains FeedsExJsonUtility.
View source
class FeedsExJsonUtility {
/**
* Translates an error message.
*
* @param int $error
* The JSON error.
*
* @return string
* The JSON parsing error message.
*/
public static function translateError($error) {
switch ($error) {
case JSON_ERROR_NONE:
return;
case JSON_ERROR_DEPTH:
return 'Maximum stack depth exceeded';
case JSON_ERROR_STATE_MISMATCH:
return 'Underflow or the modes mismatch';
case JSON_ERROR_CTRL_CHAR:
return 'Unexpected control character found';
case JSON_ERROR_SYNTAX:
return 'Syntax error, malformed JSON';
case JSON_ERROR_UTF8:
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
default:
return 'Unknown error';
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedsExJsonUtility:: |
public static | function | Translates an error message. |