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.

 Methods

Constructor

__construct(null | string $name, \Zend\Session\ManagerInterface $manager) 
Inherited

Provide a name ('Default' if none provided) and a ManagerInterface instance.

inherited_from \Zend\Session\AbstractContainer::__construct()

Parameters

$name

nullstring

Exceptions

\Zend\Session\Exception\InvalidArgumentException

Returns the value at the specified key by reference

__get(mixed $key) : mixed
Inherited

inherited_from \Zend\Stdlib\ArrayObject::__get()
inherited_from \Zend\Session\AbstractContainer::__get()

Parameters

$key

mixed

Returns

mixed

Returns whether the requested key exists

__isset(mixed $key) : bool
Inherited

inherited_from \Zend\Stdlib\ArrayObject::__isset()
inherited_from \Zend\Session\AbstractContainer::__isset()

Parameters

$key

mixed

Returns

bool

Sets the value at the specified key to value

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

inherited_from \Zend\Stdlib\ArrayObject::__set()
inherited_from \Zend\Session\AbstractContainer::__set()

Parameters

$key

mixed

$value

mixed

Unsets the value at the specified key

__unset(mixed $key) : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::__unset()
inherited_from \Zend\Session\AbstractContainer::__unset()

Parameters

$key

mixed

Appends the value

append(mixed $value) : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::append()
inherited_from \Zend\Session\AbstractContainer::append()

Parameters

$value

mixed

Sort the entries by value

asort() : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::asort()
inherited_from \Zend\Session\AbstractContainer::asort()

Get the number of public properties in the ArrayObject

count() : int
Inherited

inherited_from \Zend\Stdlib\ArrayObject::count()
inherited_from \Zend\Session\AbstractContainer::count()

Returns

int

Exchange the current array with another array or object.

exchangeArray(array | object $input) : array
Inherited

see \Zend\Stdlib\ArrayObject::exchangeArray()
inherited_from \Zend\Session\AbstractContainer::exchangeArray()

Parameters

$input

arrayobject

Returns

arrayReturns the old array

Creates a copy of the specific container name

getArrayCopy() : array
Inherited

inherited_from \Zend\Session\AbstractContainer::getArrayCopy()

Returns

array

Get the default ManagerInterface instance

getDefaultManager() : \Zend\Session\ManagerInterface
Inherited

If none provided, instantiates one of type $managerDefaultClass

inherited_from \Zend\Session\AbstractContainer::getDefaultManager()

Exceptions

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

Returns

Gets the behavior flags.

getFlags() : int
Inherited

inherited_from \Zend\Stdlib\ArrayObject::getFlags()
inherited_from \Zend\Session\AbstractContainer::getFlags()

Returns

int

Iterate over session container

getIterator() : \Iterator
Inherited

inherited_from \Zend\Session\AbstractContainer::getIterator()

Returns

\Iterator

Gets the iterator classname for the ArrayObject.

getIteratorClass() : string
Inherited

inherited_from \Zend\Stdlib\ArrayObject::getIteratorClass()
inherited_from \Zend\Session\AbstractContainer::getIteratorClass()

Returns

string

Get manager instance

getManager() : \Zend\Session\ManagerInterface
Inherited

inherited_from \Zend\Session\AbstractContainer::getManager()

Returns

Get container name

getName() : string
Inherited

inherited_from \Zend\Session\AbstractContainer::getName()

Returns

string

Sort the entries by key

ksort() : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::ksort()
inherited_from \Zend\Session\AbstractContainer::ksort()

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

natcasesort() : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::natcasesort()
inherited_from \Zend\Session\AbstractContainer::natcasesort()

Sort entries using a "natural order" algorithm

natsort() : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::natsort()
inherited_from \Zend\Session\AbstractContainer::natsort()

Determine if the key exists

offsetExists(string $key) : bool
Inherited

inherited_from \Zend\Session\AbstractContainer::offsetExists()

Parameters

$key

string

Returns

bool

Retrieve a specific key in the container

offsetGet(string $key) : mixed

Parameters

$key

string

Returns

mixed

Store a value within the container

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

inherited_from \Zend\Session\AbstractContainer::offsetSet()

Parameters

$key

string

$value

mixed

Unset a single key in the container

offsetUnset(string $key) : void
Inherited

inherited_from \Zend\Session\AbstractContainer::offsetUnset()

Parameters

$key

string

Serialize an ArrayObject

serialize() : string
Inherited

inherited_from \Zend\Stdlib\ArrayObject::serialize()
inherited_from \Zend\Session\AbstractContainer::serialize()

Returns

string

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

setDefaultManager(\Zend\Session\ManagerInterface $manager) : void
Inherited

inherited_from \Zend\Session\AbstractContainer::setDefaultManager()

Parameters

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

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

inherited_from \Zend\Session\AbstractContainer::setExpirationHops()

Parameters

$hops

int

$vars

nullstringarray

Exceptions

\Zend\Session\Exception\InvalidArgumentException

Returns

Set expiration TTL

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

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

inherited_from \Zend\Session\AbstractContainer::setExpirationSeconds()

Parameters

$ttl

int

TTL in seconds

$vars

stringarraynull

Exceptions

\Zend\Session\Exception\InvalidArgumentException

Returns

Sets the behavior flags

setFlags(int $flags) : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::setFlags()
inherited_from \Zend\Session\AbstractContainer::setFlags()

Parameters

$flags

int

Sets the iterator classname for the ArrayObject

setIteratorClass(string $class) : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::setIteratorClass()
inherited_from \Zend\Session\AbstractContainer::setIteratorClass()

Parameters

$class

string

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

uasort(\Zend\Stdlib\callable $function) : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::uasort()
inherited_from \Zend\Session\AbstractContainer::uasort()

Parameters

$function

\Zend\Stdlib\callable

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

uksort(\Zend\Stdlib\callable $function) : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::uksort()
inherited_from \Zend\Session\AbstractContainer::uksort()

Parameters

$function

\Zend\Stdlib\callable

Unserialize an ArrayObject

unserialize(string $data) : void
Inherited

inherited_from \Zend\Stdlib\ArrayObject::unserialize()
inherited_from \Zend\Session\AbstractContainer::unserialize()

Parameters

$data

string

Create a new container object on which to act

createContainer() : \Zend\Stdlib\ArrayObject
Inherited

inherited_from \Zend\Session\AbstractContainer::createContainer()

Returns

Expire a key by expiry time

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

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

inherited_from \Zend\Session\AbstractContainer::expireByExpiryTime()

Parameters

$name

string

Container name

$key

string

Key in container to check

Returns

bool

Expire key by session hops

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

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

inherited_from \Zend\Session\AbstractContainer::expireByHops()

Parameters

$name

string

$key

string

Returns

bool

Determine whether a given key needs to be expired

expireKeys(null | string $key) : bool
Inherited

Returns true if the key has expired, false otherwise.

inherited_from \Zend\Session\AbstractContainer::expireKeys()

Parameters

$key

nullstring

Returns

bool

Get session storage object

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

Proxies to ManagerInterface::getStorage()

inherited_from \Zend\Session\AbstractContainer::getStorage()

Returns

Set session manager

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

inherited_from \Zend\Session\AbstractContainer::setManager()

Parameters

Exceptions

\Zend\Session\Exception\InvalidArgumentException

Returns

Verify container namespace

verifyNamespace(bool $createContainer) : \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.

inherited_from \Zend\Session\AbstractContainer::verifyNamespace()

Parameters

$createContainer

bool

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
Inherited

inherited_from \Zend\Session\AbstractContainer::$$defaultManager
 

$flag

$flag : int
Inherited

inherited_from \Zend\Stdlib\ArrayObject::$$flag
inherited_from \Zend\Session\AbstractContainer::$$flag
 

$iteratorClass

$iteratorClass : string
Inherited

inherited_from \Zend\Stdlib\ArrayObject::$$iteratorClass
inherited_from \Zend\Session\AbstractContainer::$$iteratorClass
 

$manager

$manager : \Zend\Session\ManagerInterface
Inherited

inherited_from \Zend\Session\AbstractContainer::$$manager
 

Default manager class to use if no manager has been provided

$managerDefaultClass : string
Inherited

inherited_from \Zend\Session\AbstractContainer::$$managerDefaultClass
 

Container name

$name : string
Inherited

inherited_from \Zend\Session\AbstractContainer::$$name
 

$protectedProperties

$protectedProperties : array
Inherited

inherited_from \Zend\Stdlib\ArrayObject::$$protectedProperties
inherited_from \Zend\Session\AbstractContainer::$$protectedProperties
 

$storage

$storage : array
Inherited

inherited_from \Zend\Stdlib\ArrayObject::$$storage
inherited_from \Zend\Session\AbstractContainer::$$storage

 Constants

 

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

ARRAY_AS_PROPS 
Inherited

inherited_from \Zend\Stdlib\ArrayObject::ARRAY_AS_PROPS
inherited_from \Zend\Session\AbstractContainer::ARRAY_AS_PROPS
 

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

STD_PROP_LIST 
Inherited

inherited_from \Zend\Stdlib\ArrayObject::STD_PROP_LIST
inherited_from \Zend\Session\AbstractContainer::STD_PROP_LIST