Documentation

ContextAwareEncoderInterface extends EncoderInterface

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

Tags
author

Kévin Dunglas dunglas@gmail.com

Table of Contents

Methods

encode()  : string
Encodes data into the given format.
supportsEncoding()  : bool
Checks whether the serializer can encode to given format.

Methods

encode()

Encodes data into the given format.

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

Data to encode

$format : string

Format name

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

Options that normalizers/encoders have access to

Tags
throws
UnexpectedValueException
Return values
string

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