PageRenderTime 52ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/src/application/libraries/Zend/Auth/Storage/NonPersistent.php

https://bitbucket.org/masnug/grc276-blog-laravel
PHP | 95 lines | 22 code | 8 blank | 65 comment | 0 complexity | c5dfc968cd1c15c207bac78f19da1ddd 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_Auth
  17. * @subpackage Storage
  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 23775 2011-03-01 17:25:24Z ralph $
  21. */
  22. /**
  23. * @see Zend_Auth_Storage_Interface
  24. */
  25. require_once 'Zend/Auth/Storage/Interface.php';
  26. /**
  27. * Non-Persistent Auth Storage
  28. *
  29. * Since HTTP Authentication 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. * @category Zend
  34. * @package Zend_Auth
  35. * @subpackage Storage
  36. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  37. * @license http://framework.zend.com/license/new-bsd New BSD License
  38. */
  39. class Zend_Auth_Storage_NonPersistent implements Zend_Auth_Storage_Interface
  40. {
  41. /**
  42. * Holds the actual auth data
  43. */
  44. protected $_data;
  45. /**
  46. * Returns true if and only if storage is empty
  47. *
  48. * @throws Zend_Auth_Storage_Exception If it is impossible to determine whether storage is empty
  49. * @return boolean
  50. */
  51. public function isEmpty()
  52. {
  53. return empty($this->_data);
  54. }
  55. /**
  56. * Returns the contents of storage
  57. * Behavior is undefined when storage is empty.
  58. *
  59. * @throws Zend_Auth_Storage_Exception If reading contents from storage is impossible
  60. * @return mixed
  61. */
  62. public function read()
  63. {
  64. return $this->_data;
  65. }
  66. /**
  67. * Writes $contents to storage
  68. *
  69. * @param mixed $contents
  70. * @throws Zend_Auth_Storage_Exception If writing $contents to storage is impossible
  71. * @return void
  72. */
  73. public function write($contents)
  74. {
  75. $this->_data = $contents;
  76. }
  77. /**
  78. * Clears contents from storage
  79. *
  80. * @throws Zend_Auth_Storage_Exception If clearing contents from storage is impossible
  81. * @return void
  82. */
  83. public function clear()
  84. {
  85. $this->_data = null;
  86. }
  87. }