\SuperClosureSerializerInterface

Interface for a serializer that is used to serialize Closure objects.

Summary

Methods
Constants
serialize()
unserialize()
getData()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

serialize()

serialize(\Closure  $closure) : string

Takes a Closure object, decorates it with a SerializableClosure object, then performs the serialization.

Parameters

\Closure $closure

Closure to serialize.

Returns

string —

Serialized closure.

unserialize()

unserialize(string  $serialized) : \Closure

Takes a serialized closure, performs the unserialization, and then extracts and returns a the Closure object.

Parameters

string $serialized

Serialized closure.

Throws

\SuperClosure\Exception\ClosureUnserializationException

if unserialization fails.

Returns

\Closure —

Unserialized closure.

getData()

getData(\Closure  $closure, boolean  $forSerialization = false) : \Closure

Retrieves data about a closure including its code, context, and binding.

The data returned is dependant on the ClosureAnalyzer implementation used and whether the $forSerialization parameter is set to true. If $forSerialization is true, then only data relevant to serializing the closure is returned.

Parameters

\Closure $closure

Closure to analyze.

boolean $forSerialization

Include only serialization data.

Returns

\Closure