~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Auth/Storage/NonPersistent.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 Zend_Auth_Storage
 
18
 * @copyright  Copyright (c) 2005-2008 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 8862 2008-03-16 15:36:00Z thomas $
 
21
 */
 
22
 
 
23
 
 
24
/**
 
25
 * @see Zend_Auth_Storage_Interface
 
26
 */
 
27
require_once 'Zend/Auth/Storage/Interface.php';
 
28
 
 
29
 
 
30
/**
 
31
 * Non-Persistent Auth Storage
 
32
 *
 
33
 * Since HTTP Authentication happens again on each request, this will always be
 
34
 * re-populated. So there's no need to use sessions, this simple value class
 
35
 * will hold the data for rest of the current request.
 
36
 *
 
37
 * @category   Zend
 
38
 * @package    Zend_Auth
 
39
 * @subpackage Zend_Auth_Storage
 
40
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
41
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
42
 */
 
43
class Zend_Auth_Storage_NonPersistent implements Zend_Auth_Storage_Interface
 
44
{
 
45
    /**
 
46
     * Holds the actual auth data
 
47
     */
 
48
    protected $_data;
 
49
 
 
50
 
 
51
    /**
 
52
     * Returns true if and only if storage is empty
 
53
     *
 
54
     * @throws Zend_Auth_Storage_Exception If it is impossible to determine whether storage is empty
 
55
     * @return boolean
 
56
     */
 
57
    public function isEmpty()
 
58
    {
 
59
        return empty($this->_data);
 
60
    }
 
61
 
 
62
    /**
 
63
     * Returns the contents of storage
 
64
     * Behavior is undefined when storage is empty.
 
65
     *
 
66
     * @throws Zend_Auth_Storage_Exception If reading contents from storage is impossible
 
67
     * @return mixed
 
68
     */
 
69
    public function read()
 
70
    {
 
71
        return $this->_data;
 
72
    }
 
73
 
 
74
    /**
 
75
     * Writes $contents to storage
 
76
     *
 
77
     * @param  mixed $contents
 
78
     * @throws Zend_Auth_Storage_Exception If writing $contents to storage is impossible
 
79
     * @return void
 
80
     */
 
81
    public function write($contents)
 
82
    {
 
83
        $this->_data = $contents;
 
84
    }
 
85
 
 
86
    /**
 
87
     * Clears contents from storage
 
88
     *
 
89
     * @throws Zend_Auth_Storage_Exception If clearing contents from storage is impossible
 
90
     * @return void
 
91
     */
 
92
    public function clear()
 
93
    {
 
94
        $this->_data = null;
 
95
    }
 
96
}