Documentation

JsonTranscoder
in package
implements Transcoder

Interfaces, Classes, Traits and Enums

Transcoder

Table of Contents

$decodeAssociative  : bool
$decodeDepth  : int
$decodeFlags  : int
$encodeDepth  : int
$encodeFlags  : int
$instance  : JsonTranscoder|null
__construct()  : mixed
decode()  : mixed
Decodes data using json_decode() from json extension
encode()  : array<string|int, mixed>
Encodes data using json_encode() from json extension
getInstance()  : Transcoder

Properties

Methods

__construct()

public __construct([bool $decodeAssociative = true ][, int $decodeDepth = 512 ][, int $decodeFlags = JSON_THROW_ON_ERROR ][, int $encodeFlags = JSON_THROW_ON_ERROR ][, int $encodeDepth = 512 ]) : mixed
Parameters
$decodeAssociative : bool = true

passed as $associative to json_decode()

$decodeDepth : int = 512

passed as $depth to json_decode()

$decodeFlags : int = JSON_THROW_ON_ERROR

passed as $flags to json_decode()

$encodeFlags : int = JSON_THROW_ON_ERROR

passed as $flags to json_encode()

$encodeDepth : int = 512

passed as $depth to json_encode()

Return values
mixed

decode()

Decodes data using json_decode() from json extension

public decode(string $bytes, int $flags) : mixed
Parameters
$bytes : string

encoded data

$flags : int

flags from network layer, that describes format of the encoded data

Tags
throws
DecodingFailureException
since
4.0.0
Return values
mixed

decoded document

encode()

Encodes data using json_encode() from json extension

public encode(mixed $value) : array<string|int, mixed>
Parameters
$value : mixed

document

Tags
since
4.0.0
Return values
array<string|int, mixed>

tuple of encoded value with flags for network layer


        

Search results