Class SessionStorage

Summary

Fully Qualified Name: Zend\Session\Storage\SessionStorage
Extends: ArrayStorage

Description

Session storage in $_SESSION

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

Methods

Name Description Defined By
__construct() Constructor SessionStorage
__destruct() Destructor SessionStorage
__get() Returns the value at the specified key by reference ArrayObject
__isset() Returns whether the requested key exists ArrayObject
__set() Sets the value at the specified key to value ArrayObject
__unset() Unsets the value at the specified key ArrayObject
append() Appends the value ArrayObject
asort() Sort the entries by value ArrayObject
clear() Clear the storage object or a subkey of the object ArrayStorage
count() Get the number of public properties in the ArrayObject ArrayObject
exchangeArray() Exchange the array for another one. ArrayObject
fromArray() Load session object from an existing array SessionStorage
getArrayCopy() Creates a copy of the ArrayObject. ArrayObject
getFlags() Gets the behavior flags. ArrayObject
getIterator() Create a new iterator from an ArrayObject instance ArrayObject
getIteratorClass() Gets the iterator classname for the ArrayObject. ArrayObject
getMetadata() Retrieve metadata for the storage object or a specific metadata key ArrayStorage
getRequestAccessTime() Retrieve the request access time ArrayStorage
isImmutable() Determine if this object is isImmutable SessionStorage
isLocked() Is the object or key marked as locked? ArrayStorage
ksort() Sort the entries by key ArrayObject
lock() Lock this storage instance, or a key within it ArrayStorage
markImmutable() Mark object as isImmutable SessionStorage
natcasesort() Sort an array using a case insensitive "natural order" algorithm ArrayObject
natsort() Sort entries using a "natural order" algorithm ArrayObject
offsetExists() Returns whether the requested key exists ArrayObject
offsetGet() Returns the value at the specified key ArrayObject
offsetSet() ArrayStorage
offsetUnset() Unsets the value at the specified key ArrayObject
serialize() Serialize an ArrayObject ArrayObject
setFlags() Sets the behavior flags ArrayObject
setIteratorClass() Sets the iterator classname for the ArrayObject ArrayObject
setMetadata() Set storage metadata ArrayStorage
toArray() Cast the object to an array ArrayStorage
uasort() Sort the entries with a user-defined comparison function and maintain key association ArrayObject
uksort() Sort the entries by keys using a user-defined comparison function ArrayObject
unlock() Unlock an object or key marked as locked ArrayStorage
unserialize() Unserialize an ArrayObject ArrayObject

Method Details

__construct()

Constructor

Sets the $_SESSION superglobal to an ArrayObject, maintaining previous values if any discovered.

Parameter Name Type Description
$input array|null
$flags int
$iteratorClass string

Returns:

__destruct()

Destructor

Resets $_SESSION superglobal to an array, by casting object using getArrayCopy().

Returns: void

__get()

Returns the value at the specified key by reference

Parameter Name Type Description
$key mixed

Returns: mixed

__isset()

Returns whether the requested key exists

Parameter Name Type Description
$key mixed

Returns: bool

__set()

Sets the value at the specified key to value

Parameter Name Type Description
$key mixed
$value mixed

Returns: void

__unset()

Unsets the value at the specified key

Parameter Name Type Description
$key mixed

Returns: void

append()

Appends the value

Parameter Name Type Description
$value mixed

Returns: void

asort()

Sort the entries by value

Returns: void

clear()

Clear the storage object or a subkey of the object

Parameter Name Type Description
$key null|int|string

Returns: \ArrayStorage

count()

Get the number of public properties in the ArrayObject

Returns: int

exchangeArray()

Exchange the array for another one.

Parameter Name Type Description
$data array|\ArrayObject

Returns: array

fromArray()

Load session object from an existing array

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

Parameter Name Type Description
$array array

Returns: \SessionStorage

getArrayCopy()

Creates a copy of the ArrayObject.

Returns: array

getFlags()

Gets the behavior flags.

Returns: int

getIterator()

Create a new iterator from an ArrayObject instance

Returns: \Iterator

getIteratorClass()

Gets the iterator classname for the ArrayObject.

Returns: string

getMetadata()

Retrieve metadata for the storage object or a specific metadata key

Returns false if no metadata stored, or no metadata exists for the given key.

Parameter Name Type Description
$key null|int|string

Returns: mixed

getRequestAccessTime()

Retrieve the request access time

Returns: float

isImmutable()

Determine if this object is isImmutable

Returns: bool

isLocked()

Is the object or key marked as locked?

Parameter Name Type Description
$key null|int|string

Returns: bool

ksort()

Sort the entries by key

Returns: void

lock()

Lock this storage instance, or a key within it

Parameter Name Type Description
$key null|int|string

Returns: \ArrayStorage

markImmutable()

Mark object as isImmutable

Returns: \SessionStorage

natcasesort()

Sort an array using a case insensitive "natural order" algorithm

Returns: void

natsort()

Sort entries using a "natural order" algorithm

Returns: void

offsetExists()

Returns whether the requested key exists

Parameter Name Type Description
$key mixed

Returns: bool

offsetGet()

Returns the value at the specified key

Parameter Name Type Description
$key mixed

Returns: mixed

offsetSet()

Parameter Name Type Description
$key mixed
$value mixed

Returns:

offsetUnset()

Unsets the value at the specified key

Parameter Name Type Description
$key mixed

Returns: void

serialize()

Serialize an ArrayObject

Returns: string

setFlags()

Sets the behavior flags

Parameter Name Type Description
$flags int

Returns: void

setIteratorClass()

Sets the iterator classname for the ArrayObject

Parameter Name Type Description
$class string

Returns: void

setMetadata()

Set storage metadata

Metadata is used to store information about the data being stored in the object. Some example use cases include:

Parameter Name Type Description
$key string
$value mixed
$overwriteArray bool Whether

Returns: \ArrayStorage

toArray()

Cast the object to an array

Parameter Name Type Description
$metaData bool Whether

Returns: array

uasort()

Sort the entries with a user-defined comparison function and maintain key association

Parameter Name Type Description
$function callable

Returns: void

uksort()

Sort the entries by keys using a user-defined comparison function

Parameter Name Type Description
$function callable

Returns: void

unlock()

Unlock an object or key marked as locked

Parameter Name Type Description
$key null|int|string

Returns: \ArrayStorage

unserialize()

Unserialize an ArrayObject

Parameter Name Type Description
$data string

Returns: void

Top