Source of file Session.php
Size: 2,768 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Authentication/Storage/Session.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Authentication\Storage; use Zend\Session\Container as SessionContainer; use Zend\Session\ManagerInterface as SessionManager; class Session implements StorageInterface { /** * Default session namespace */ const NAMESPACE_DEFAULT = 'Zend_Auth'; /** * Default session object member name */ const MEMBER_DEFAULT = 'storage'; /** * Object to proxy $_SESSION storage * * @var SessionContainer */ protected $session; /** * Session namespace * * @var mixed */ protected $namespace = self::NAMESPACE_DEFAULT; /** * Session object member * * @var mixed */ protected $member = self::MEMBER_DEFAULT; /** * Sets session storage options and initializes session namespace object * * @param mixed $namespace * @param mixed $member * @param SessionManager $manager */ public function __construct($namespace = null, $member = null, SessionManager $manager = null) { if ($namespace !== null) { $this->namespace = $namespace; } if ($member !== null) { $this->member = $member; } $this->session = new SessionContainer($this->namespace, $manager); } /** * Returns the session namespace * * @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\Authentication\Storage\StorageInterface * * @return bool */ public function isEmpty() { return !isset($this->session->{$this->member}); } /** * Defined by Zend\Authentication\Storage\StorageInterface * * @return mixed */ public function read() { return $this->session->{$this->member}; } /** * Defined by Zend\Authentication\Storage\StorageInterface * * @param mixed $contents * @return void */ public function write($contents) { $this->session->{$this->member} = $contents; } /** * Defined by Zend\Authentication\Storage\StorageInterface * * @return void */ public function clear() { unset($this->session->{$this->member}); } } |