Method | Description | |
---|---|---|
__construct ( |
Creates a new encoder. | |
encode ( mixed $data, string | object $schema = null ) : string | Encodes data as JSON. | |
encodeFile ( mixed $data, string $path, string | object $schema = null ) | Encodes data into a JSON file. | |
getArrayEncoding ( ) : integer | Returns the encoding of non-associative arrays. | |
getMaxDepth ( ) : integer | Returns the maximum recursion depth. | |
getNumericEncoding ( ) : integer | Returns the encoding of numeric strings. | |
isAmpersandEscaped ( ) : boolean | Returns whether ampersands (&) are escaped. | |
isDoubleQuoteEscaped ( ) : boolean | Returns whether double quotes (") are escaped. | |
isGtLtEscaped ( ) : boolean | Returns whether greater than/less than symbols (>, <) are escaped. | |
isPrettyPrinting ( ) : boolean | Returns whether JSON strings are formatted for better readability. | |
isSingleQuoteEscaped ( ) : boolean | Returns whether single quotes (') are escaped. | |
isSlashEscaped ( ) : boolean | Returns whether forward slashes (/) are escaped. | |
isTerminatedWithLineFeed ( ) : boolean | Returns whether JSON strings are terminated with a line feed. | |
isUnicodeEscaped ( ) : boolean | Returns whether unicode characters are escaped. | |
setArrayEncoding ( integer $encoding ) | Sets the encoding of non-associative arrays. | |
setEscapeAmpersand ( boolean $enabled ) | Sets whether ampersands (&) should be escaped. | |
setEscapeDoubleQuote ( boolean $enabled ) | Sets whether double quotes (") should be escaped. | |
setEscapeGtLt ( boolean $enabled ) | Sets whether greater than/less than symbols (>, <) should be escaped. | |
setEscapeSingleQuote ( boolean $enabled ) | Sets whether single quotes (") should be escaped. | |
setEscapeSlash ( boolean $enabled ) | Sets whether forward slashes (") should be escaped. | |
setEscapeUnicode ( boolean $enabled ) | Sets whether unicode characters should be escaped. | |
setMaxDepth ( integer $maxDepth ) | Sets the maximum recursion depth. | |
setNumericEncoding ( integer $encoding ) | Sets the encoding of numeric strings. | |
setPrettyPrinting ( boolean $prettyPrinting ) | Sets whether JSON strings should be formatted for better readability. | |
setTerminateWithLineFeed ( boolean $enabled ) | Sets whether JSON strings should be terminated with a line feed. |
public __construct ( |
||
$validator |
public getArrayEncoding ( ) : integer | ||
return | integer | One of the constants {@link JSON_OBJECT} and {@link JSON_ARRAY} |
public getMaxDepth ( ) : integer | ||
return | integer | The maximum recursion depth |
public getNumericEncoding ( ) : integer | ||
return | integer | One of the constants {@link JSON_STRING} and {@link JSON_NUMBER} |
public isAmpersandEscaped ( ) : boolean | ||
return | boolean | Whether ampersands are escaped |
public isDoubleQuoteEscaped ( ) : boolean | ||
return | boolean | Whether double quotes are escaped |
public isGtLtEscaped ( ) : boolean | ||
return | boolean | Whether greater than/less than symbols are escaped |
public isPrettyPrinting ( ) : boolean | ||
return | boolean | Whether JSON strings are formatted |
public isSingleQuoteEscaped ( ) : boolean | ||
return | boolean | Whether single quotes are escaped |
public isSlashEscaped ( ) : boolean | ||
return | boolean | Whether forward slashes are escaped |
public isTerminatedWithLineFeed ( ) : boolean | ||
return | boolean | Whether JSON strings are terminated with a line feed |
public isUnicodeEscaped ( ) : boolean | ||
return | boolean | Whether unicode characters are escaped |
public setArrayEncoding ( integer $encoding ) | ||
$encoding | integer | One of the constants {@link JSON_OBJECT} and {@link JSON_ARRAY} |
public setEscapeAmpersand ( boolean $enabled ) | ||
$enabled | boolean | Whether ampersands should be escaped |
public setEscapeDoubleQuote ( boolean $enabled ) | ||
$enabled | boolean | Whether double quotes should be escaped |
public setEscapeGtLt ( boolean $enabled ) | ||
$enabled | boolean | Whether greater than/less than should be escaped |
public setEscapeSingleQuote ( boolean $enabled ) | ||
$enabled | boolean | Whether single quotes should be escaped |
public setEscapeSlash ( boolean $enabled ) | ||
$enabled | boolean | Whether forward slashes should be escaped |
public setEscapeUnicode ( boolean $enabled ) | ||
$enabled | boolean | Whether unicode characters should be escaped |
public setMaxDepth ( integer $maxDepth ) | ||
$maxDepth | integer | The maximum recursion depth |
public setNumericEncoding ( integer $encoding ) | ||
$encoding | integer | One of the constants {@link JSON_STRING} and {@link JSON_NUMBER} |
public setPrettyPrinting ( boolean $prettyPrinting ) | ||
$prettyPrinting | boolean | Whether JSON strings should be formatted |
public setTerminateWithLineFeed ( boolean $enabled ) | ||
$enabled | boolean | Whether JSON strings should be terminated with a line feed |