SerializeTrait
Implements a PHP serialiser.
Important notes!:
- by default this will only serialize public + protected properties.
- Child object that implement
NotSerializableare not included.
You can extend, or restrict, serialization per class by overriding
the getSerializedProperties() method.
Table of Contents
Methods
- __serialize() : array<string|int, mixed>
- __unserialize() : void
- getSerializedProperties() : array<string|int, mixed>
- Get an array of properties to serialize.
Methods
__serialize()
public
__serialize() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
Tags
getSerializedProperties()
Get an array of properties to serialize.
protected
getSerializedProperties() : array<string|int, mixed>
Override this to modify the behaviour of the serializer.
By default, this returns properties that are:
- public
- not private or protected
- not static
- not implementing
NotSerializable
Return values
array<string|int, mixed> —[string => value]