Session/Namespace.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Session
- Since
- Preview Release 0.2
- Version
- $Id$
\Zend_Session_Namespace
Package: Zend_SessionZend_Session_Namespace
- Implements
- Parent(s)
- \Zend_Session_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants


SINGLE_INSTANCE
= trueused as option to constructor to prevent additional instances to the same namespace
Properties



string $_namespace = "Default"Namespace - which namespace this instance of zend-session is saving-to/getting-from
Default value"Default"Details- Type
- string



array $_namespaceLocks = array()staticNamespace locking mechanism
Default valuearray()Details- Type
- array



array $_singleInstances = array()staticSingle instance namespace array to ensure data security.
Default valuearray()Details- Type
- array
Methods



__construct(string $namespace = 'Default', bool $singleInstance = false) : void__construct() - Returns an instance object bound to a particular, isolated section
of the session, identified by $namespace name (defaulting to 'Default').
The optional argument $singleInstance will prevent construction of additional
instance objects acting as accessors to this $namespace.
Parameters| Name | Type | Description |
|---|
| $namespace | string |
- programmatic name of the requested namespace
|
|---|
| $singleInstance | bool |
- prevent creation of additional accessor instance objects for this namespace
|
|---|



__get(string $name) : mixed__get() - method to get a variable in this object's current namespace
Parameters| Name | Type | Description |
|---|
| $name | string |
- programmatic name of a key, in a pair in the current namespace
|
|---|
Returns 


__isset(string $name) : bool__isset() - determine if a variable in this object's namespace is set
Parameters| Name | Type | Description |
|---|
| $name | string |
- programmatic name of a key, in a pair in the current namespace
|
|---|
Returns 


__set(string $name, mixed $value) : true__set() - method to set a variable/value in this object's namespace
Parameters| Name | Type | Description |
|---|
| $name | string |
- programmatic name of a key, in a pair in the current namespace
|
|---|
| $value | mixed |
- value in the pair to assign to the $name key
|
|---|
ReturnsThrows 


__unset(string $name) : true__unset() - unset a variable in this object's namespace.
Parameters| Name | Type | Description |
|---|
| $name | string |
- programmatic name of a key, in a pair in the current namespace
|
|---|
Returns 


apply(string | array $callback) : voidapply() - enables applying user-selected function, such as array_merge() to the namespace
Parameters following the $callback argument are passed to the callback function.
Caveat: ignores members expiring now.
Example:
$namespace->apply('array_merge', array('tree' => 'apple', 'fruit' => 'peach'), array('flower' => 'rose'));
$namespace->apply('count');
Parameters| Name | Type | Description |
|---|
| $callback | string | array | |
|---|



applySet(string | array $callback) : voidapplySet() - enables applying user-selected function, and sets entire namespace to the result
Result of $callback must be an array.
Parameters following the $callback argument are passed to the callback function.
Caveat: ignores members expiring now.
Example:
$namespace->applySet('array_merge', array('tree' => 'apple', 'fruit' => 'peach'), array('flower' => 'rose'));
Parameters| Name | Type | Description |
|---|
| $callback | string | array | |
|---|



getIterator() : \ArrayObjectgetIterator() - return an iteratable object for use in foreach and the like,
this completes the IteratorAggregate interface
Returns| Type | Description |
|---|
| \ArrayObject | - iteratable container of the namespace contents |



resetSingleInstance(string $namespaceName = null) : nullstaticresetSingleInstance()
Parameters| Name | Type | Description |
|---|
| $namespaceName | string | |
|---|
Returns 


setExpirationHops(int $hops, mixed $variables = null, boolean $hopCountOnUsageOnly = false) : voidsetExpirationHops() - expire the namespace, or specific variables after a specified
number of page hops
Parameters| Name | Type | Description |
|---|
| $hops | int |
- how many "hops" (number of subsequent requests) before expiring
|
|---|
| $variables | mixed |
- OPTIONAL list of variables to expire (defaults to all)
|
|---|
| $hopCountOnUsageOnly | boolean |
- OPTIONAL if set, only count a hop/request if this namespace is used
|
|---|
Throws 


setExpirationSeconds(int $seconds, mixed $variables = null) : voidsetExpirationSeconds() - expire the namespace, or specific variables after a specified
number of seconds
Parameters| Name | Type | Description |
|---|
| $seconds | int |
- expires in this many seconds
|
|---|
| $variables | mixed |
- OPTIONAL list of variables to expire (defaults to all)
|
|---|
Throws