PHP Class Opis\Closure\SerializableClosure

Inheritance: implements Serializabl\Serializable
Mostra file Open project: opis/closure Class Usage Examples

Protected Properties

Property Type Description
$bindingSupported Indicates is closures can be bound to objects
$closure Wrapped closure
$code Used on unserializations to hold variables
$context Context of closure, used in serialization
$deserialized Unserialized closures
$isBound Indicates if closure is bound to an object
$reference Used to fix serialization in PHP 5.3
$reflector A reflection instance for closure
$scope Closure scope
$serializeThis Indicates if closure must be serialized with bounded object
$unserializations Number of unserializations in progress

Public Methods

Method Description
__construct ( Closure $closure, boolean $serializeThis = false ) Constructor
__invoke ( ) Implementation of magic method __invoke()
enterContext ( ) Increments the contex lock counter or creates a new context if none exist
exitContext ( ) Decrements the context lock counter and destroy the context when it reaches to 0
from ( Closure $closure, boolean $serializeThis = false ) : self Wraps a closure and sets the serialization context (if any)
getClosure ( ) : Closure Get the Closure object
getReflector ( ) : ReflectionClosure Get the reflector for closure
serialize ( ) : string Implementation of Serializable::serialize()
supportBinding ( ) : boolean Indicates is closures can be bound to objects
unserialize ( string $data ) Implementation of Serializable::unserialize()
unserializeData ( $data ) Helper method for unserialization

Protected Methods

Method Description
getClosurePointer ( ) : Closure Internal method used to get a reference from closure
mapByReference ( &$value ) : mixed Internal method used to map closures by reference
mapPointers ( &$value ) : mixed Internal method used to map the pointers on unserialization
unserializePHP53 ( &$data ) Internal method used to unserialize closures in PHP 5.3

Method Details

__construct() public method

Constructor
public __construct ( Closure $closure, boolean $serializeThis = false )
$closure Closure Closure you want to serialize
$serializeThis boolean - Obsolete

__invoke() public method

Implementation of magic method __invoke()
public __invoke ( )

enterContext() public static method

Increments the contex lock counter or creates a new context if none exist
public static enterContext ( )

exitContext() public static method

Decrements the context lock counter and destroy the context when it reaches to 0
public static exitContext ( )

from() public static method

Wraps a closure and sets the serialization context (if any)
public static from ( Closure $closure, boolean $serializeThis = false ) : self
$closure Closure Closure to be wrapped
$serializeThis boolean - Obsolete
return self The wrapped closure

getClosure() public method

Get the Closure object
public getClosure ( ) : Closure
return Closure The wrapped closure

getClosurePointer() protected method

Internal method used to get a reference from closure
protected getClosurePointer ( ) : Closure
return Closure A pointer to closure

getReflector() public method

Get the reflector for closure
public getReflector ( ) : ReflectionClosure
return ReflectionClosure

mapByReference() protected method

Internal method used to map closures by reference
protected mapByReference ( &$value ) : mixed
return mixed The mapped values

mapPointers() protected method

Internal method used to map the pointers on unserialization
protected mapPointers ( &$value ) : mixed
return mixed Mapped pointers

serialize() public method

Implementation of Serializable::serialize()
public serialize ( ) : string
return string The serialized closure

supportBinding() public static method

Indicates is closures can be bound to objects
public static supportBinding ( ) : boolean
return boolean

unserialize() public method

Implementation of Serializable::unserialize()
public unserialize ( string $data )
$data string Serialized data

unserializeData() public static method

Helper method for unserialization
public static unserializeData ( $data )

unserializePHP53() protected method

Internal method used to unserialize closures in PHP 5.3
protected unserializePHP53 ( &$data )

Property Details

$bindingSupported protected_oe static_oe property

Indicates is closures can be bound to objects
See also: Opis\Closure\SerializableClosure::supportBinding()
protected static $bindingSupported

$closure protected_oe property

Wrapped closure
See also: Opis\Closure\SerializableClosure::getClosure()
protected $closure

$code protected_oe property

Used on unserializations to hold variables
See also: Opis\Closure\SerializableClosure::unserialize()
See also: Opis\Closure\SerializableClosure::getReflector()
protected $code

$context protected_oe static_oe property

Context of closure, used in serialization
protected static $context

$deserialized protected_oe static_oe property

Unserialized closures
See also: Opis\Closure\SerializableClosure::unserializePHP53()
protected static $deserialized

$isBound protected_oe property

Indicates if closure is bound to an object
protected $isBound

$reference protected_oe property

Used to fix serialization in PHP 5.3
protected $reference

$reflector protected_oe property

A reflection instance for closure
See also: Opis\Closure\SerializableClosure::getReflector()
protected $reflector

$scope protected_oe property

Closure scope
protected $scope

$serializeThis protected_oe property

Indicates if closure must be serialized with bounded object
protected $serializeThis

$unserializations protected_oe static_oe property

Number of unserializations in progress
See also: Opis\Closure\SerializableClosure::unserializePHP53()
protected static $unserializations