Session storage container

Allows for interacting with session storage in isolated containers, which may have their own expiries, or even expiries per key in the container. Additionally, expiries may be absolute TTLs or measured in "hops", which are based on how many times the key or container were accessed.

package Default
inherited_from \Zend\Session\AbstractContainer

 Methods

Constructor

__construct(array $input = array(), integer $flags = self::STD_PROP_LIST, string $iteratorClass = 'ArrayIterator'
Inherited

Parameters

$input

array

$flags

integer

$iteratorClass

string

Returns the value at the specified key by reference

__get(mixed $key) : mixed
Inherited

Parameters

$key

mixed

Returns

mixed

Returns whether the requested key exists

__isset(mixed $key) : boolean
Inherited

Parameters

$key

mixed

Returns

boolean

Sets the value at the specified key to value

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

Parameters

$key

mixed

$value

mixed

Unsets the value at the specified key

__unset(mixed $key) : void
Inherited

Parameters

$key

mixed

Appends the value

append(mixed $value) : void
Inherited

Parameters

$value

mixed

Sort the entries by value

asort() : void
Inherited

Get the number of public properties in the ArrayObject

count() : integer
Inherited

Returns

integer

Exchange the array for another one.

exchangeArray(array|\Zend\Stdlib\ArrayObject $data) : array
Inherited

Parameters

$data

array\Zend\Stdlib\ArrayObject

Returns

array

Creates a copy of the ArrayObject.

getArrayCopy() : array
Inherited

Returns

array

Get the default ManagerInterface instance

getDefaultManager() : \Zend\Session\ManagerInterface
InheritedStatic

If none provided, instantiates one of type \$managerDefaultClass

Exceptions

\Zend\Session\Exception\InvalidArgumentException if invalid manager default class provided

Returns

\Zend\Session\ManagerInterface

Gets the behavior flags.

getFlags() : integer
Inherited

Returns

integer

Create a new iterator from an ArrayObject instance

getIterator() : \Iterator
Inherited

Returns

\Iterator

Gets the iterator classname for the ArrayObject.

getIteratorClass() : string
Inherited

Returns

string

Get manager instance

getManager() : \Zend\Session\ManagerInterface
Inherited

Returns

\Zend\Session\ManagerInterface

Get container name

getName() : string
Inherited

Returns

string

Sort the entries by key

ksort() : void
Inherited

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

natcasesort() : void
Inherited

Sort entries using a "natural order" algorithm

natsort() : void
Inherited

Returns whether the requested key exists

offsetExists(mixed $key) : boolean
Inherited

Parameters

$key

mixed

Returns

boolean

Retrieve a specific key in the container

offsetGet(string $key) : mixed
inherited_from \Zend\Session\AbstractContainer::offsetGet()

Parameters

$key

string

Returns

mixed

Returns the value at the specified key

offsetGet(mixed $key) : mixed
Inherited

Parameters

$key

mixed

Returns

mixed

Sets the value at the specified key to value

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

Parameters

$key

mixed

$value

mixed

Unsets the value at the specified key

offsetUnset(mixed $key) : void
Inherited

Parameters

$key

mixed

Serialize an ArrayObject

serialize() : string
Inherited

Returns

string

Set the default ManagerInterface instance to use when none provided to constructor

setDefaultManager(\Zend\Session\ManagerInterface $manager = null) : void
InheritedStatic

Parameters

$manager

\Zend\Session\ManagerInterface

Set expiration hops for the container, a single key, or set of keys

setExpirationHops(integer $hops, null|string|array $vars = null) : \Zend\Session\Container
Inherited

Parameters

$hops

integer

$vars

nullstringarray

Exceptions

\Zend\Session\Exception\InvalidArgumentException

Returns

\Zend\Session\Container

Set expiration TTL

setExpirationSeconds(integer $ttl, string|array|null $vars = null) : \Zend\Session\Container
Inherited

Set the TTL for the entire container, a single key, or a set of keys.

Parameters

$ttl

integer

TTL in seconds

$vars

stringarraynull

Exceptions

\Zend\Session\Exception\InvalidArgumentException

Returns

\Zend\Session\Container

Sets the behavior flags

setFlags(integer $flags) : void
Inherited

Parameters

$flags

integer

Sets the iterator classname for the ArrayObject

setIteratorClass(string $class) : void
Inherited

Parameters

$class

string

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

uasort(callable $function) : void
Inherited

Parameters

$function

callable

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

uksort(callable $function) : void
Inherited

Parameters

$function

callable

Unserialize an ArrayObject

unserialize(string $data) : void
Inherited

Parameters

$data

string

Create a new container object on which to act

createContainer() : \Zend\Stdlib\ArrayObject
Inherited

Returns

\Zend\Stdlib\ArrayObject

Expire a key by expiry time

expireByExpiryTime(\Zend\Session\Storage\StorageInterface $storage, string $name, string $key) : boolean
Inherited

Checks to see if the entire container has expired based on TTL setting, or the individual key.

Parameters

$storage

\Zend\Session\Storage\StorageInterface

$name

string

Container name

$key

string

Key in container to check

Returns

boolean

Expire key by session hops

expireByHops(\Zend\Session\Storage\StorageInterface $storage, string $name, string $key) : boolean
Inherited

Determines whether the container or an individual key within it has expired based on session hops

Parameters

$storage

\Zend\Session\Storage\StorageInterface

$name

string

$key

string

Returns

boolean

Determine whether a given key needs to be expired

expireKeys(null|string $key = null) : boolean
Inherited

Returns true if the key has expired, false otherwise.

Parameters

$key

nullstring

Returns

boolean

Get session storage object

getStorage() : \Zend\Session\Storage\StorageInterface
Inherited

Proxies to ManagerInterface::getStorage()

Returns

\Zend\Session\Storage\StorageInterface

Set session manager

setManager(null|\Zend\Session\ManagerInterface $manager = null) : \Zend\Session\Container
Inherited

Parameters

$manager

null\Zend\Session\ManagerInterface

Exceptions

\Zend\Session\Exception\InvalidArgumentException

Returns

\Zend\Session\Container

Verify container namespace

verifyNamespace(boolean $createContainer = true) : \Zend\Session\Storage\StorageInterface | null
Inherited

Checks to see if a container exists within the Storage object already. If not, one is created; if so, checks to see if it's an ArrayObject. If not, it raises an exception; otherwise, it returns the Storage object.

Parameters

$createContainer

boolean

Whether or not to create the container for the namespace

Exceptions

\Zend\Session\Exception\RuntimeException

Returns

\Zend\Session\Storage\StorageInterfacenullReturns null only if $createContainer is false

 Properties

 

Default manager to use when instantiating a container without providing a ManagerInterface

$defaultManager : \Zend\Session\ManagerInterface

Default

Static
 

$flag

$flag : integer

Default

 

$iteratorClass

$iteratorClass : string

Default

 

$manager

$manager : \Zend\Session\ManagerInterface

Default

 

Default manager class to use if no manager has been provided

$managerDefaultClass : string

Default

'Zend\\Session\\SessionManager'
Static
 

Container name

$name : string

Default

 

$protectedProperties

$protectedProperties : array

Default

 

$storage

$storage : array

Default

 Constants

 

Entries can be accessed as properties (read and write).

ARRAY_AS_PROPS = 2 
 

Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.).

STD_PROP_LIST = 1