Session/Namespace.php

Show: PublicProtectedPrivateinherited
Table of Contents
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Session  
Since
Preview Release 0.2  
Version
$Id: Namespace.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Session_Namespace

Package: Zend\Session
Zend_Session_Namespace
Implements
Parent(s)
\Zend_Session_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  SINGLE_INSTANCE = true
used as option to constructor to prevent additional instances to the same namespace
>VConstant  _THROW_NOT_WRITABLE_MSG = 'Zend_Session is currently marked as read-only.'
inherited
Error message thrown when an action requires modification, but current Zend_Session has been marked as read-only.
Inherited from: \Zend_Session_Abstract::_THROW_NOT_WRITABLE_MSG
>VConstant  _THROW_NOT_READABLE_MSG = 'Zend_Session is not marked as readable.'
inherited
Error message thrown when an action requires reading session data, but current Zend_Session is not marked as readable.
Inherited from: \Zend_Session_Abstract::_THROW_NOT_READABLE_MSG

Properties

>VPropertyprotectedarray $_expiringData = array()
staticinherited
Since expiring data is handled at startup to avoid __destruct difficulties, the data that will be expiring at end of this request is held here
Inherited from: \Zend_Session_Abstract::$$_expiringData
Default valuearray()Details
Type
array
Inherited_from
\Zend_Session_Abstract::$$_expiringData  
>VPropertyprotectedstring $_namespace = "Default"
Namespace - which namespace this instance of zend-session is saving-to/getting-from
Default value"Default"Details
Type
string
>VPropertyprotectedarray $_namespaceLocks = array()
static
Namespace locking mechanism
Default valuearray()Details
Type
array
>VPropertyprotectedbool $_readable = false
staticinherited
Whether or not session permits reading (reading data in $_SESSION[])
Inherited from: \Zend_Session_Abstract::$$_readable
Default valuefalseDetails
Type
bool
Inherited_from
\Zend_Session_Abstract::$$_readable  
>VPropertyprotectedarray $_singleInstances = array()
static
Single instance namespace array to ensure data security.
Default valuearray()Details
Type
array
>VPropertyprotectedbool $_writable = false
staticinherited
Whether or not session permits writing (modification of $_SESSION[])
Inherited from: \Zend_Session_Abstract::$$_writable
Default valuefalseDetails
Type
bool
Inherited_from
\Zend_Session_Abstract::$$_writable  

Methods

methodpublic__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
NameTypeDescription
$namespacestring
  • programmatic name of the requested namespace
$singleInstancebool
  • prevent creation of additional accessor instance objects for this namespace
methodpublic__get(string $name) : mixed

__get() - method to get a variable in this object's current namespace

Parameters
NameTypeDescription
$namestring
  • programmatic name of a key, in a pair in the current namespace
Returns
TypeDescription
mixed
methodpublic__isset(string $name) : bool

__isset() - determine if a variable in this object's namespace is set

Parameters
NameTypeDescription
$namestring
  • programmatic name of a key, in a pair in the current namespace
Returns
TypeDescription
bool
methodpublic__set(string $name, mixed $value) : true

__set() - method to set a variable/value in this object's namespace

Parameters
NameTypeDescription
$namestring
  • programmatic name of a key, in a pair in the current namespace
$valuemixed
  • value in the pair to assign to the $name key
Returns
TypeDescription
true
Throws
ExceptionDescription
\Zend_Session_Exception
methodpublic__unset(string $name) : true

__unset() - unset a variable in this object's namespace.

Parameters
NameTypeDescription
$namestring
  • programmatic name of a key, in a pair in the current namespace
Returns
TypeDescription
true
methodprotected_namespaceGet(string $namespace, string $name = null) : mixed
staticinherited

namespaceGet() - Get $name variable from $namespace, returning by reference.

Inherited from: \Zend_Session_Abstract::_namespaceGet()
Parameters
NameTypeDescription
$namespacestring
$namestring
Returns
TypeDescription
mixed
methodprotected_namespaceGetAll(string $namespace) : mixed
staticinherited

namespaceGetAll() - Get an array containing $namespace, including expiring data.

Inherited from: \Zend_Session_Abstract::_namespaceGetAll()
Parameters
NameTypeDescription
$namespacestring
Returns
TypeDescription
mixed
methodprotected_namespaceIsset(string $namespace, string $name = null) : bool
staticinherited

namespaceIsset() - check to see if a namespace or a variable within a namespace is set

Inherited from: \Zend_Session_Abstract::_namespaceIsset()
Parameters
NameTypeDescription
$namespacestring
$namestring
Returns
TypeDescription
bool
methodprotected_namespaceUnset(string $namespace, string $name = null) : void
staticinherited

namespaceUnset() - unset a namespace or a variable within a namespace

Inherited from: \Zend_Session_Abstract::_namespaceUnset()
Parameters
NameTypeDescription
$namespacestring
$namestring
Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicapply(string | array $callback) : void

apply() - 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
NameTypeDescription
$callbackstring | array
  • callback function
methodpublicapplySet(string | array $callback) : void

applySet() - 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
NameTypeDescription
$callbackstring | array
  • callback function
methodpublicgetIterator() : \ArrayObject

getIterator() - return an iteratable object for use in foreach and the like, this completes the IteratorAggregate interface

Returns
TypeDescription
\ArrayObject- iteratable container of the namespace contents
methodpublicgetNamespace() : string

Returns the namespace name

Returns
TypeDescription
string
methodpublicisLocked() : bool

isLocked() - return lock status, true if, and only if, read-only

Returns
TypeDescription
bool
methodpubliclock() : void

lock() - mark a session/namespace as readonly

methodpublicresetSingleInstance(string $namespaceName = null) : null
static

resetSingleInstance()

Parameters
NameTypeDescription
$namespaceNamestring
Returns
TypeDescription
null
methodpublicsetExpirationHops(int $hops, mixed $variables = null, boolean $hopCountOnUsageOnly = false) : void

setExpirationHops() - expire the namespace, or specific variables after a specified number of page hops

Parameters
NameTypeDescription
$hopsint
  • how many "hops" (number of subsequent requests) before expiring
$variablesmixed
  • OPTIONAL list of variables to expire (defaults to all)
$hopCountOnUsageOnlyboolean
  • OPTIONAL if set, only count a hop/request if this namespace is used
Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicsetExpirationSeconds(int $seconds, mixed $variables = null) : void

setExpirationSeconds() - expire the namespace, or specific variables after a specified number of seconds

Parameters
NameTypeDescription
$secondsint
  • expires in this many seconds
$variablesmixed
  • OPTIONAL list of variables to expire (defaults to all)
Throws
ExceptionDescription
\Zend_Session_Exception
methodpublicunlock() : void

unlock() - unmark a session/namespace to enable read & write

methodpublicunlockAll() : void
static

unlockAll() - unmark all session/namespaces to enable read & write

methodpublicunsetAll() : true

unsetAll() - unset all variables in this namespace

Returns
TypeDescription
true
Documentation was generated by phpDocumentor 2.0.0a12.