Documentation

ChainEncoder
in package
implements ContextAwareEncoderInterface

Encoder delegating the decoding to a chain of encoders.

Tags
author

Jordi Boggiano j.boggiano@seld.be

author

Johannes M. Schmitt schmittjoh@gmail.com

author

Lukas Kahwe Smith smith@pooteeweet.org

final

Table of Contents

Interfaces

ContextAwareEncoderInterface
Adds the support of an extra $context parameter for the supportsEncoding method.

Properties

$encoderByFormat  : array<string|int, mixed>
$encoders  : array<string|int, mixed>

Methods

__construct()  : mixed
encode()  : string
{@inheritdoc}
needsNormalization()  : bool
Checks whether the normalization is needed for the given format.
supportsEncoding()  : bool
Checks whether the serializer can encode to given format.
getEncoder()  : EncoderInterface
Gets the encoder supporting the format.

Properties

$encoderByFormat

private array<string|int, mixed> $encoderByFormat = []

$encoders

private array<string|int, mixed> $encoders = []

Methods

__construct()

public __construct([array<string|int, mixed> $encoders = [] ]) : mixed
Parameters
$encoders : array<string|int, mixed> = []

encode()

{@inheritdoc}

public final encode(mixed $data, string $format[, array<string|int, mixed> $context = [] ]) : string
Parameters
$data : mixed
$format : string
$context : array<string|int, mixed> = []
Return values
string

needsNormalization()

Checks whether the normalization is needed for the given format.

public needsNormalization(string $format[, array<string|int, mixed> $context = [] ]) : bool
Parameters
$format : string
$context : array<string|int, mixed> = []
Return values
bool

supportsEncoding()

Checks whether the serializer can encode to given format.

public supportsEncoding(string $format[, array<string|int, mixed> $context = [] ]) : bool
Parameters
$format : string

Format name

$context : array<string|int, mixed> = []

options that encoders have access to

Return values
bool

        
On this page

Search results