Session storage in $_SESSION

Replaces the $_SESSION superglobal with an ArrayObject that allows for property access, metadata storage, locking, and immutability.

 Methods

Constructor

__construct(array | null $input) 

Parameters

$input

arraynull

Destructor

__destruct() : void

Get Offset

__get(mixed $key) : mixed

Parameters

$key

mixed

Returns

mixed

Isset Offset

__isset(mixed $key) : bool

Parameters

$key

mixed

Returns

bool

Set Offset

__set(mixed $key, mixed $value) : void

Parameters

$key

mixed

$value

mixed

Unset Offset

__unset(mixed $key) : void

Parameters

$key

mixed

Clear the storage object or a subkey of the object

clear(null | int | string $key) : \Zend\Session\Storage\ArrayStorage

Parameters

$key

nullintstring

Exceptions

\Zend\Session\Exception\RuntimeException

Returns

Count

count() : int

Returns

int

Load session object from an existing array

fromArray(array $array) : \Zend\Session\Storage\SessionStorage

Ensures $_SESSION is set to an instance of the object when complete.

Parameters

$array

array

Returns

Get Iterator

getIterator() : \ArrayIterator

Returns

Retrieve the request access time

getRequestAccessTime() : float

Returns

float

Initialize Storage

init(array $input) : void

Parameters

$input

array

Determine if this object is isImmutable

isImmutable() : bool

Returns

bool

Is the object or key marked as locked?

isLocked(null | int | string $key) : bool

Parameters

$key

nullintstring

Returns

bool

Lock this storage instance, or a key within it

lock(null | int | string $key) : \Zend\Session\Storage\ArrayStorage

Parameters

$key

nullintstring

Returns

Mark object as isImmutable

markImmutable() : \Zend\Session\Storage\SessionStorage

Offset Exists

offsetExists(mixed $key) : bool

Parameters

$key

mixed

Returns

bool

Offset Get

offsetGet(mixed $key) : mixed

Parameters

$key

mixed

Returns

mixed

Offset Set

offsetSet(mixed $key, mixed $value) : void

Parameters

$key

mixed

$value

mixed

Offset Unset

offsetUnset(mixed $key) : void

Parameters

$key

mixed

Seralize

serialize() : string

Returns

string

Cast the object to an array

toArray(bool $metaData) : array

Parameters

$metaData

bool

Whether to include metadata

Returns

array

Unlock an object or key marked as locked

unlock(null | int | string $key) : \Zend\Session\Storage\ArrayStorage

Parameters

$key

nullintstring

Returns

Unserialize

unserialize(string $session) : mixed

Parameters

$session

string

Returns

mixed

Set the request access time

setRequestAccessTime(float $time) : \Zend\Session\Storage\ArrayStorage

Parameters

$time

float

Returns