JsonFormatter
extends AbstractFormatter
in package
Class JsonFormatter
Table of Contents
Properties
- $decodeOptions : array<string|int, mixed>
- $encodeOptions : array<string|int, mixed>
Methods
- __construct() : mixed
- IniFormatter constructor.
- __serialize() : array<string|int, mixed>
- __unserialize() : void
- decode() : mixed
- Decode a string into data.
- encode() : string
- Encode data into a string.
- getDecodeAssoc() : bool
- Returns true if JSON objects will be converted into associative arrays.
- getDecodeDepth() : int
- Returns recursion depth used in decode() function.
- getDecodeOptions() : int
- Returns options used in decode() function.
- getDefaultFileExtension() : string
- Get default file extension from current formatter (with dot).
- getEncodeOptions() : int
- Returns options used in encode() function.
- getMimeType() : string
- getSupportedFileExtensions() : array<string|int, string>
- Get file extensions supported by current formatter (with dot).
- serialize() : string
- unserialize() : void
- getConfig() : mixed
- Get either full configuration or a single option.
- getUnserializeAllowedClasses() : array<string|int, mixed>|bool
Properties
$decodeOptions
protected
array<string|int, mixed>
$decodeOptions
= ['JSON_BIGINT_AS_STRING' => JSON_BIGINT_AS_STRING, 'JSON_INVALID_UTF8_IGNORE' => JSON_INVALID_UTF8_IGNORE, 'JSON_INVALID_UTF8_SUBSTITUTE' => JSON_INVALID_UTF8_SUBSTITUTE, 'JSON_OBJECT_AS_ARRAY' => JSON_OBJECT_AS_ARRAY]
$encodeOptions
protected
array<string|int, mixed>
$encodeOptions
= ['JSON_FORCE_OBJECT' => JSON_FORCE_OBJECT, 'JSON_HEX_QUOT' => JSON_HEX_QUOT, 'JSON_HEX_TAG' => JSON_HEX_TAG, 'JSON_HEX_AMP' => JSON_HEX_AMP, 'JSON_HEX_APOS' => JSON_HEX_APOS, 'JSON_INVALID_UTF8_IGNORE' => JSON_INVALID_UTF8_IGNORE, 'JSON_INVALID_UTF8_SUBSTITUTE' => JSON_INVALID_UTF8_SUBSTITUTE, 'JSON_NUMERIC_CHECK' => JSON_NUMERIC_CHECK, 'JSON_PARTIAL_OUTPUT_ON_ERROR' => JSON_PARTIAL_OUTPUT_ON_ERROR, 'JSON_PRESERVE_ZERO_FRACTION' => JSON_PRESERVE_ZERO_FRACTION, 'JSON_PRETTY_PRINT' => JSON_PRETTY_PRINT, 'JSON_UNESCAPED_LINE_TERMINATORS' => JSON_UNESCAPED_LINE_TERMINATORS, 'JSON_UNESCAPED_SLASHES' => JSON_UNESCAPED_SLASHES, 'JSON_UNESCAPED_UNICODE' => JSON_UNESCAPED_UNICODE]
Methods
__construct()
IniFormatter constructor.
public
__construct([array<string|int, mixed> $config = [] ]) : mixed
Parameters
- $config : array<string|int, mixed> = []
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
decode()
Decode a string into data.
public
decode(mixed $data) : mixed
Parameters
- $data : mixed
-
String to be decoded.
Tags
Return values
mixed —Returns decoded data.
encode()
Encode data into a string.
public
encode(mixed $data) : string
Parameters
- $data : mixed
-
Data to be encoded.
Tags
Return values
string —Returns encoded data as a string.
getDecodeAssoc()
Returns true if JSON objects will be converted into associative arrays.
public
getDecodeAssoc() : bool
Return values
boolgetDecodeDepth()
Returns recursion depth used in decode() function.
public
getDecodeDepth() : int
Tags
Return values
intgetDecodeOptions()
Returns options used in decode() function.
public
getDecodeOptions() : int
Return values
intgetDefaultFileExtension()
Get default file extension from current formatter (with dot).
public
getDefaultFileExtension() : string
Tags
Return values
string —Returns file extension (can be empty).
getEncodeOptions()
Returns options used in encode() function.
public
getEncodeOptions() : int
Return values
intgetMimeType()
public
getMimeType() : string
Return values
stringgetSupportedFileExtensions()
Get file extensions supported by current formatter (with dot).
public
getSupportedFileExtensions() : array<string|int, string>
Tags
Return values
array<string|int, string> —Returns list of all supported file extensions.
serialize()
public
final serialize() : string
Return values
stringunserialize()
public
final unserialize(string $serialized) : void
Parameters
- $serialized : string
getConfig()
Get either full configuration or a single option.
protected
getConfig([string|null $name = null ]) : mixed
Parameters
- $name : string|null = null
-
Configuration option (optional)
getUnserializeAllowedClasses()
protected
getUnserializeAllowedClasses() : array<string|int, mixed>|bool