root/trunk/src/main/php/net/stubbles/ipo/session/stubSession.php

Revision 1530, 3.7 kB (checked in by mikey, 1 month ago)

replaced stubSessionException with stubIllegalStateException

Line 
1 <?php
2 /**
3  * interface for sessions
4  *
5  * @author      Frank Kleine <mikey@stubbles.net>
6  * @package     stubbles
7  * @subpackage  ipo_session
8  */
9 /**
10  * interface for sessions
11  *
12  * @package     stubbles
13  * @subpackage  ipo_session
14  */
15 interface stubSession extends stubObject
16 {
17     /**
18      * key to be associated with the start time of the session
19      */
20     const START_TIME           = '__stubbles_SessionStartTime';
21     /**
22      * key to be associated with the token for the next request
23      */
24     const NEXT_TOKEN           = '__stubbles_SessionNextToken';
25     /**
26      * key to be associated with the fingerprint of the user
27      */
28     const FINGERPRINT          = '__stubbles_SessionFingerprint';
29     /**
30      * registry key for session class to be used
31      */
32     const CLASS_REGISTRY_KEY   = 'net.stubbles.ipo.session.class';
33     /**
34      * registry key for session fingerprint salt to be used
35      */
36     const SALT_REGISTRY_KEY    = 'net.stubbles.ipo.session.fingerprintSalt';
37     /**
38      * registry key for session name to be used
39      */
40     const NAME_REGISTRY_KEY    = 'net.stubbles.ipo.session.name';
41     /**
42      * default session name
43      */
44     const DEFAULT_SESSION_NAME = 'PHPSESSID';
45
46     /**
47      * checks whether session has been started
48      *
49      * Typically, a session is new on the first request of a user,
50      * afterwards it should never be new.
51      *
52      * @return  bool  true if session has been started, else false
53      */
54     public function isNew();
55
56     /**
57      * returns unix timestamp when session was started
58      *
59      * @return  int
60      */
61     public function getStartTime();
62     
63     /**
64      * returns session id
65      *
66      * @return  string  the session id
67      */
68     public function getId();
69     
70     /**
71      * returns the name of the session
72      *
73      * @return  string
74      */
75     public function getName();
76
77     /**
78      * regenerates the session id but leaves session data
79      */
80     public function regenerateId();
81
82     /**
83      * returns token of current request
84      *
85      * @return  string  the token
86      */
87     public function getCurrentToken();
88     
89     /**
90      * returns token for next request
91      *
92      * @return  string  the token
93      */
94     public function getNextToken();
95     
96     /**
97      * checks if this session is valid
98      *
99      * @return  bool
100      */
101     public function isValid();
102     
103     /**
104      * invalidates current session and creates a new one
105      */
106     public function invalidate();
107     
108     /**
109      * resets the session and deletes all session data
110      *
111      * @return  int
112      */
113     public function reset();
114     
115     /**
116      * stores a value associated with the key
117      *
118      * @param  string  $key    key to store value under
119      * @param  mixed   $value  data to store
120      */
121     public function putValue($key, $value);
122     
123     /**
124      * returns a value associated with the key or the default value
125      *
126      * @param   string  $key      key where value is stored under
127      * @param   mixed   $default  optional  return this if no data is associated with $key
128      * @return  mixed
129      */
130     public function getValue($key, $default = null);
131     
132     /**
133      * checks whether a value associated with key exists
134      *
135      * @param   string  $key  key where value is stored under
136      * @return  bool
137      */
138     public function hasValue($key);
139     
140     /**
141      * removes a value from the session
142      *
143      * @param   string  $name  key where value is stored under
144      * @return  bool    true if value existed and was removed, else false
145      */
146     public function removeValue($name);
147     
148     /**
149      * return an array of all keys registered in this session
150      *
151      * @return  array<string>
152      */
153     public function getValueKeys();
154 }
155 ?>
Note: See TracBrowser for help on using the browser.