\Gishiki\Algorithms\CollectionsSerializableCollection

The structured data management class.

Summary

Methods
Properties
Constants
__construct()
serialize()
deserialize()
__toString()
No public properties found
JSON
XML
YAML
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

JSON

JSON

XML

XML

YAML

YAML

Methods

__construct()

__construct(array  $data = array()) 

Create serializable data collection from the given array.

Parameters

array $data

the collection of properties

Throws

\InvalidArgumentException

an invalid collection was given

serialize()

serialize(integer  $format = self::JSON) : string

Serialize the current data collection.

Parameters

integer $format

an integer representing one of the allowed formats

Throws

\InvalidArgumentException

the serialization format is invalid

\Gishiki\Algorithms\Collections\SerializationException

the error occurred while serializing the collection in json format

Returns

string —

the collection serialized

deserialize()

deserialize(string|array|\Gishiki\Algorithms\Collections\CollectionInterface  $message, integer  $format = self::JSON) : \Gishiki\Algorithms\Collections\SerializableCollection

Deserialize the given data collection and create a serializable data collection.

Parameters

string|array|\Gishiki\Algorithms\Collections\CollectionInterface $message

the string containing the serialized data or the array of data

integer $format

an integer representing one of the allowed formats

Throws

\Gishiki\Algorithms\Collections\DeserializationException

the error preventing the data deserialization

Returns

\Gishiki\Algorithms\Collections\SerializableCollection

the deserialization result

__toString()

__toString() : string

Get the serialization result using the default format.

Returns

string —

the serialization result