class Yaml implements SerializationInterface (View source)

Provides a YAML serialization implementation.

Proxy implementation that will choose the best library based on availability.

Properties

static protected SerializationInterface $serializer

The YAML implementation to use.

Methods

static string
encode(mixed $data)

Encodes data into the serialization format.

static mixed
decode(string $raw)

Decodes data from the serialization format.

static string
getFileExtension()

Gets the file extension for this serialization format.

static 
getSerializer()

Determines which implementation to use for parsing YAML.

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 string getFileExtension()

Gets the file extension for this serialization format.

Return Value

string

The file extension, without leading dot.

static protected getSerializer()

Determines which implementation to use for parsing YAML.