Documentation

JsonConverter extends Converter
in package

Json converter with the ability to serialize/unserialize DTO objects using JSON.

Table of Contents

Constants

JSON_FLAGS  = \JSON_THROW_ON_ERROR | \JSON_PRESERVE_ZERO_FRACTION

Properties

$marshaller  : MarshallerInterface

Methods

__construct()  : mixed
fromPayload()  : mixed|void
getEncodingType()  : string
Returns associated encoding type.
toPayload()  : Payload|null
Implements conversion of a single value to Payload. Must return null if value can't be encoded.
create()  : Payload
createDefaultMarshaller()  : MarshallerInterface
createDefaultReader()  : ReaderInterface
errorInvalidType()  : DataConverterException
errorInvalidTypeName()  : DataConverterException
toHashMap()  : array<string|int, mixed>
unmarshal()  : T

Constants

JSON_FLAGS

public int JSON_FLAGS = \JSON_THROW_ON_ERROR | \JSON_PRESERVE_ZERO_FRACTION

Properties

Methods

__construct()

public __construct([MarshallerInterface|null $marshaller = null ]) : mixed
Parameters
$marshaller : MarshallerInterface|null = null

getEncodingType()

Returns associated encoding type.

public getEncodingType() : string
Return values
string

toPayload()

Implements conversion of a single value to Payload. Must return null if value can't be encoded.

public toPayload(mixed $value) : Payload|null
Parameters
$value : mixed
Tags
throws
DataConverterException
Return values
Payload|null

create()

protected create(string $data) : Payload
Parameters
$data : string
Return values
Payload

createDefaultMarshaller()

private static createDefaultMarshaller() : MarshallerInterface
Return values
MarshallerInterface

createDefaultReader()

private static createDefaultReader() : ReaderInterface
Return values
ReaderInterface

toHashMap()

private toHashMap(object|array<string|int, mixed> $context) : array<string|int, mixed>
Parameters
$context : object|array<string|int, mixed>
Return values
array<string|int, mixed>

unmarshal()

private unmarshal(object|array<string|int, mixed> $data, ReflectionClass<string|int, T$reflection) : T
Parameters
$data : object|array<string|int, mixed>
$reflection : ReflectionClass<string|int, T>
Tags
template

T of object

Return values
T

        
On this page

Search results