diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Http/UserAgent/Storage/Session.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Http/UserAgent/Storage/Session.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,166 @@ +toArray(); + } elseif (is_object($options)) { + $options = (array) $options; + } + if (null !== $options && !is_array($options)) { + require_once 'Zend/Http/UserAgent/Storage/Exception.php'; + throw new Zend_Http_UserAgent_Storage_Exception(sprintf( + 'Expected array or object options; "%s" provided', + gettype($options) + )); + } + + // add '.' to prevent the message ''Session namespace must not start with a number' + $this->_namespace = '.' + . (isset($options['browser_type']) + ? $options['browser_type'] + : self::NAMESPACE_DEFAULT); + $this->_member = isset($options['member']) ? $options['member'] : self::MEMBER_DEFAULT; + $this->_session = new Zend_Session_Namespace($this->_namespace); + } + + /** + * Returns the session namespace name + * + * @return string + */ + public function getNamespace() + { + return $this->_namespace; + } + + /** + * Returns the name of the session object member + * + * @return string + */ + public function getMember() + { + return $this->_member; + } + + /** + * Defined by Zend_Http_UserAgent_Storage + * + * @return boolean + */ + public function isEmpty() + { + return empty($this->_session->{$this->_member}); + } + + /** + * Defined by Zend_Http_UserAgent_Storage + * + * @return mixed + */ + public function read() + { + return $this->_session->{$this->_member}; + } + + /** + * Defined by Zend_Http_UserAgent_Storage + * + * @param mixed $contents + * @return void + */ + public function write($content) + { + $this->_session->{$this->_member} = $content; + } + + /** + * Defined by Zend_Http_UserAgent_Storage + * + * @return void + */ + public function clear() + { + unset($this->_session->{$this->_member}); + } +}