PageRenderTime 50ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/concreteOLD/libraries/3rdparty/Zend/Http/UserAgent/Storage/NonPersistent.php

https://bitbucket.org/selfeky/xclusivescardwebsite
PHP | 97 lines | 23 code | 8 blank | 66 comment | 0 complexity | 6b1da1644ec91fd48fe4b30b7c089a05 MD5 | raw file
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Http
  17. * @subpackage UserAgent
  18. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: NonPersistent.php 20096 2010-01-06 02:05:09Z bkarwin $
  21. */
  22. /**
  23. * @see Zend_Http_UserAgent_Storage_Interface
  24. */
  25. require_once 'Zend/Http/UserAgent/Storage.php';
  26. /**
  27. * Non-Persistent Browser Storage
  28. *
  29. * Since HTTP Browserentication happens again on each request, this will always be
  30. * re-populated. So there's no need to use sessions, this simple value class
  31. * will hold the data for rest of the current request.
  32. *
  33. * @package Zend_Http
  34. * @subpackage UserAgent
  35. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  36. * @license http://framework.zend.com/license/new-bsd New BSD License
  37. */
  38. class Zend_Http_UserAgent_Storage_NonPersistent
  39. implements Zend_Http_UserAgent_Storage
  40. {
  41. /**
  42. * Holds the actual Browser data
  43. * @var mixed
  44. */
  45. protected $_data;
  46. /**
  47. * Returns true if and only if storage is empty
  48. *
  49. * @throws Zend_Http_UserAgent_Storage_Exception If it is impossible to determine whether storage is empty
  50. * @return boolean
  51. */
  52. public function isEmpty()
  53. {
  54. return empty($this->_data);
  55. }
  56. /**
  57. * Returns the contents of storage
  58. *
  59. * Behavior is undefined when storage is empty.
  60. *
  61. * @throws Zend_Http_UserAgent_Storage_Exception If reading contents from storage is impossible
  62. * @return mixed
  63. */
  64. public function read()
  65. {
  66. return $this->_data;
  67. }
  68. /**
  69. * Writes $contents to storage
  70. *
  71. * @param mixed $contents
  72. * @throws Zend_Http_UserAgent_Storage_Exception If writing $contents to storage is impossible
  73. * @return void
  74. */
  75. public function write($contents)
  76. {
  77. $this->_data = $contents;
  78. }
  79. /**
  80. * Clears contents from storage
  81. *
  82. * @throws Zend_Http_UserAgent_Storage_Exception If clearing contents from storage is impossible
  83. * @return void
  84. */
  85. public function clear()
  86. {
  87. $this->_data = null;
  88. }
  89. }