class LuaSerializer implements DataSerializerInterface, DataFileSerializerInterface (View source)

Lua primitive serialization

Traits

Constants

MODE_RAW

Export value "as is"

This is the default behavior of the serializeData() method

MODE_MODULE

Export value prefixed by a "return" keyword

This is the default behavior of the serializeDataToFile() method

INTEGER_PATTERN

LUA_IDENTIFIER_PATTERN

Methods

buildMediaTypeList()

No description

getMediaTypes()

No description

matchMediaType(MediaTypeInterface $mediaType)

No description

canSerializeToFile($filename, $data, MediaTypeInterface $mediaType = null)

No description

serializeToFile($filename, $data, MediaTypeInterface $mediaType = null)

No description

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

serializeTableKey($key)

No description

serializeTable($table, $level = 0)

No description

serializeLiteral($value)

No description

Details

protected buildMediaTypeList()

protected getMediaTypes()

protected matchMediaType(MediaTypeInterface $mediaType)

Parameters

MediaTypeInterface $mediaType

getSerializableFileMediaTypes()

canSerializeToFile($filename, $data, MediaTypeInterface $mediaType = null)

Parameters

$filename
$data
MediaTypeInterface $mediaType

serializeToFile($filename, $data, MediaTypeInterface $mediaType = null)

Parameters

$filename
$data
MediaTypeInterface $mediaType

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

protected serializeTableKey($key)

Parameters

$key

protected serializeTable($table, $level = 0)

Parameters

$table
$level

protected serializeLiteral($value)

Parameters

$value