Zend Framework  1.12
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
Zend_Session_Namespace Class Reference

Public Member Functions

 __construct ($namespace= 'Default', $singleInstance=false)
 __construct() - Returns an instance object bound to a particular, isolated section of the session, identified by $namespace name (defaulting to 'Default').
 
 getIterator ()
 getIterator() - return an iteratable object for use in foreach and the like, this completes the IteratorAggregate interface
 
 lock ()
 lock() - mark a session/namespace as readonly
 
 unlock ()
 unlock() - unmark a session/namespace to enable read & write
 
 isLocked ()
 isLocked() - return lock status, true if, and only if, read-only
 
 unsetAll ()
 unsetAll() - unset all variables in this namespace
 
__get ($name)
 __get() - method to get a variable in this object's current namespace
 
 __set ($name, $value)
 __set() - method to set a variable/value in this object's namespace
 
 apply ($callback)
 apply() - enables applying user-selected function, such as array_merge() to the namespace Parameters following the $callback argument are passed to the callback function.
 
 applySet ($callback)
 applySet() - enables applying user-selected function, and sets entire namespace to the result Result of $callback must be an array.
 
 __isset ($name)
 __isset() - determine if a variable in this object's namespace is set
 
 __unset ($name)
 __unset() - unset a variable in this object's namespace.
 
 setExpirationSeconds ($seconds, $variables=null)
 setExpirationSeconds() - expire the namespace, or specific variables after a specified number of seconds
 
 setExpirationHops ($hops, $variables=null, $hopCountOnUsageOnly=false)
 setExpirationHops() - expire the namespace, or specific variables after a specified number of page hops
 
 getNamespace ()
 Returns the namespace name.
 

Static Public Member Functions

static resetSingleInstance ($namespaceName=null)
 resetSingleInstance()
 
static unlockAll ()
 unlockAll() - unmark all session/namespaces to enable read & write
 

Public Attributes

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

Protected Attributes

 $_namespace = "Default"
 

Static Protected Attributes

static $_namespaceLocks = array()
 
static $_singleInstances = array()
 
- Static Protected Attributes inherited from Zend_Session_Abstract
static $_writable = false
 
static $_readable = false
 
static $_expiringData = array()
 

Additional Inherited Members

- Static Protected Member Functions inherited from Zend_Session_Abstract
static _namespaceIsset ($namespace, $name=null)
 namespaceIsset() - check to see if a namespace or a variable within a namespace is set
 
static _namespaceUnset ($namespace, $name=null)
 namespaceUnset() - unset a namespace or a variable within a namespace
 
static & _namespaceGet ($namespace, $name=null)
 namespaceGet() - Get $name variable from $namespace, returning by reference.
 
static _namespaceGetAll ($namespace)
 namespaceGetAll() - Get an array containing $namespace, including expiring data.
 

Constructor & Destructor Documentation

__construct (   $namespace = 'Default',
  $singleInstance = false 
)

__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
string$namespace- programmatic name of the requested namespace
bool$singleInstance- prevent creation of additional accessor instance objects for this namespace
Returns
void
See Also
Zend_Session_Exception
Zend_Session_Exception
Zend_Session_Exception
Zend_Session_Exception
Zend_Session_Exception

Member Function Documentation

& __get (   $name)

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

Parameters
string$name- programmatic name of a key, in a <key,value> pair in the current namespace
Returns
mixed
See Also
Zend_Session_Exception
__isset (   $name)

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

Parameters
string$name- programmatic name of a key, in a <key,value> pair in the current namespace
Returns
bool
See Also
Zend_Session_Exception
__set (   $name,
  $value 
)

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

Parameters
string$name- programmatic name of a key, in a <key,value> pair in the current namespace
mixed$value- value in the <key,value> pair to assign to the $name key
Exceptions
Zend_Session_Exception
Returns
true
See Also
Zend_Session_Exception
Zend_Session_Exception
Zend_Session_Exception
__unset (   $name)

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

Parameters
string$name- programmatic name of a key, in a <key,value> pair in the current namespace
Returns
true
See Also
Zend_Session_Exception
apply (   $callback)

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
string | array$callback- callback function
applySet (   $callback)

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
string | array$callback- callback function
See Also
Zend_Session_Exception
getIterator ( )

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

Returns
ArrayObject - iteratable container of the namespace contents
getNamespace ( )

Returns the namespace name.

Returns
string
isLocked ( )

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

Returns
bool
lock ( )

lock() - mark a session/namespace as readonly

Returns
void
static resetSingleInstance (   $namespaceName = null)
static

resetSingleInstance()

Parameters
string$namespaceName
Returns
null
setExpirationHops (   $hops,
  $variables = null,
  $hopCountOnUsageOnly = false 
)

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

Parameters
int$hops- how many "hops" (number of subsequent requests) before expiring
mixed$variables- OPTIONAL list of variables to expire (defaults to all)
boolean$hopCountOnUsageOnly- OPTIONAL if set, only count a hop/request if this namespace is used
Exceptions
Zend_Session_Exception
Returns
void
See Also
Zend_Session_Exception
Zend_Session_Exception
setExpirationSeconds (   $seconds,
  $variables = null 
)

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

Parameters
int$seconds- expires in this many seconds
mixed$variables- OPTIONAL list of variables to expire (defaults to all)
Exceptions
Zend_Session_Exception
Returns
void
See Also
Zend_Session_Exception
Zend_Session_Exception
unlock ( )

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

Returns
void
static unlockAll ( )
static

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

Returns
void
unsetAll ( )

unsetAll() - unset all variables in this namespace

Returns
true

Member Data Documentation

$_namespace = "Default"
protected
$_namespaceLocks = array()
staticprotected
$_singleInstances = array()
staticprotected
const SINGLE_INSTANCE = true

used as option to constructor to prevent additional instances to the same namespace