* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @author Icinga Development Team * */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Session; /** * Base class for handling sessions */ abstract class Session extends SessionNamespace { /** * Container for session namespaces * * @var array */ protected $namespaces = array(); /** * Read all values from the underlying session implementation */ abstract public function read(); /** * Persists changes to the underlying session implementation */ abstract public function write(); /** * Purge session */ abstract public function purge(); /** * Get or create a new session namespace * * @param string $identifier The namespace's identifier * * @return SessionNamespace */ public function getNamespace($identifier) { if (!isset($this->namespaces[$identifier])) { $this->namespaces[$identifier] = new SessionNamespace(); } return $this->namespaces[$identifier]; } /** * Clear all values and namespaces from the session cache */ public function clear() { $this->values = array(); $this->namespaces = array(); } }