interface DataSerializerInterface (View source)

Provide data serialization for one or mode content type

Methods

MediaTypeInterface[]
getSerializableDataMediaTypes()

Get the list of content type supported by the serializer interface.

boolean
canSerializeData(mixed $data, MediaTypeInterface $mediaType = null)

Indicate if the given data can be unserialized to the given media type

string
serializeData(mixed $data, MediaTypeInterface $mediaType = null)

Serialize data to a given media type

Details

MediaTypeInterface[] getSerializableDataMediaTypes()

Get the list of content type supported by the serializer interface.

Return Value

MediaTypeInterface[]

boolean canSerializeData(mixed $data, MediaTypeInterface $mediaType = null)

Indicate if the given data can be unserialized to the given media type

Parameters

mixed $data Data to serialize
MediaTypeInterface $mediaType Data output format

Return Value

boolean TRUE if the instance can serialize $data to $mediaType format

string serializeData(mixed $data, MediaTypeInterface $mediaType = null)

Serialize data to a given media type

Parameters

mixed $data Data to serialize
MediaTypeInterface $mediaType Serialization content type

Return Value

string