File indexing completed on 2025-01-19 05:21:14
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Http 0017 * @subpackage UserAgent 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id: NonPersistent.php 20096 2010-01-06 02:05:09Z bkarwin $ 0021 */ 0022 0023 0024 /** 0025 * @see Zend_Http_UserAgent_Storage_Interface 0026 */ 0027 // require_once 'Zend/Http/UserAgent/Storage.php'; 0028 0029 0030 /** 0031 * Non-Persistent Browser Storage 0032 * 0033 * Since HTTP Browserentication happens again on each request, this will always be 0034 * re-populated. So there's no need to use sessions, this simple value class 0035 * will hold the data for rest of the current request. 0036 * 0037 * @package Zend_Http 0038 * @subpackage UserAgent 0039 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0040 * @license http://framework.zend.com/license/new-bsd New BSD License 0041 */ 0042 class Zend_Http_UserAgent_Storage_NonPersistent 0043 implements Zend_Http_UserAgent_Storage 0044 { 0045 /** 0046 * Holds the actual Browser data 0047 * @var mixed 0048 */ 0049 protected $_data; 0050 0051 /** 0052 * Returns true if and only if storage is empty 0053 * 0054 * @throws Zend_Http_UserAgent_Storage_Exception If it is impossible to determine whether storage is empty 0055 * @return boolean 0056 */ 0057 public function isEmpty() 0058 { 0059 return empty($this->_data); 0060 } 0061 0062 /** 0063 * Returns the contents of storage 0064 * 0065 * Behavior is undefined when storage is empty. 0066 * 0067 * @throws Zend_Http_UserAgent_Storage_Exception If reading contents from storage is impossible 0068 * @return mixed 0069 */ 0070 public function read() 0071 { 0072 return $this->_data; 0073 } 0074 0075 /** 0076 * Writes $contents to storage 0077 * 0078 * @param mixed $contents 0079 * @throws Zend_Http_UserAgent_Storage_Exception If writing $contents to storage is impossible 0080 * @return void 0081 */ 0082 public function write($contents) 0083 { 0084 $this->_data = $contents; 0085 } 0086 0087 /** 0088 * Clears contents from storage 0089 * 0090 * @throws Zend_Http_UserAgent_Storage_Exception If clearing contents from storage is impossible 0091 * @return void 0092 */ 0093 public function clear() 0094 { 0095 $this->_data = null; 0096 } 0097 }