class YamlPecl implements SerializationInterface (View source)

Provides default serialization for YAML using the PECL extension.

Methods

static string
encode(mixed $data)

Encodes data into the serialization format.

static mixed
decode(string $raw)

Decodes data from the serialization format.

static 
errorHandler(int $severity, string $message)

Handles errors for \Drupal\Component\Serialization\YamlPecl::decode().

static string
getFileExtension()

Gets the file extension for this serialization format.

static string|bool
applyBooleanCallbacks(mixed $value, string $tag, int $flags)

Applies callbacks after parsing to ignore 1.1 style booleans.

Details

static string encode(mixed $data)

Encodes data into the serialization format.

Parameters

mixed $data

The data to encode.

Return Value

string

The encoded data.

Exceptions

InvalidDataTypeException

static mixed decode(string $raw)

Decodes data from the serialization format.

Parameters

string $raw

The raw data string to decode.

Return Value

mixed

The decoded data.

Exceptions

InvalidDataTypeException

static errorHandler(int $severity, string $message)

Handles errors for \Drupal\Component\Serialization\YamlPecl::decode().

Parameters

int $severity

The severity level of the error.

string $message

The error message to display.

See also

YamlPecl::decode

static string getFileExtension()

Gets the file extension for this serialization format.

Return Value

string

The file extension, without leading dot.

static string|bool applyBooleanCallbacks(mixed $value, string $tag, int $flags)

Applies callbacks after parsing to ignore 1.1 style booleans.

Parameters

mixed $value

Value from YAML file.

string $tag

Tag that triggered the callback.

int $flags

Scalar entity style flags.

Return Value

string|bool

FALSE, false, TRUE and true are returned as booleans, everything else is returned as a string.