ChainEncoder
in package
implements
ContextAwareEncoderInterface
Encoder delegating the decoding to a chain of encoders.
Tags
Interfaces, Classes, Traits and Enums
- ContextAwareEncoderInterface
- Adds the support of an extra $context parameter for the supportsEncoding method.
Table of Contents
- $encoderByFormat : mixed
- $encoders : mixed
- __construct() : mixed
- encode() : mixed
- {@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
protected
mixed
$encoderByFormat
= []
$encoders
protected
mixed
$encoders
= []
Methods
__construct()
public
__construct([array<string|int, mixed> $encoders = [] ]) : mixed
Parameters
- $encoders : array<string|int, mixed> = []
Return values
mixed —encode()
{@inheritdoc}
public
final encode(mixed $data, mixed $format[, array<string|int, mixed> $context = [] ]) : mixed
Parameters
- $data : mixed
- $format : mixed
- $context : array<string|int, mixed> = []
Return values
mixed —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(mixed $format[, array<string|int, mixed> $context = [] ]) : bool
Parameters
- $format : mixed
-
Format name
- $context : array<string|int, mixed> = []
-
options that encoders have access to
Return values
bool —getEncoder()
Gets the encoder supporting the format.
private
getEncoder(string $format, array<string|int, mixed> $context) : EncoderInterface
Parameters
- $format : string
- $context : array<string|int, mixed>