1 | <?php |
||
13 | class FlipSession extends Singleton |
||
14 | { |
||
15 | /** |
||
16 | * Does the variable exist in the session |
||
17 | * |
||
18 | * @SuppressWarnings(PHPMD.Superglobals) |
||
19 | */ |
||
20 | static function doesVarExist($name) |
||
24 | |||
25 | /** |
||
26 | * Get a variable from the session |
||
27 | * |
||
28 | * @SuppressWarnings(PHPMD.Superglobals) |
||
29 | */ |
||
30 | static function getVar($name, $default = false) |
||
41 | |||
42 | /** |
||
43 | * Set a variable in the session |
||
44 | * |
||
45 | * @SuppressWarnings(PHPMD.Superglobals) |
||
46 | */ |
||
47 | static function setVar($name, $value) |
||
51 | |||
52 | /** |
||
53 | * Is a user currently logged in? |
||
54 | * |
||
55 | * @SuppressWarnings(PHPMD.Superglobals) |
||
56 | */ |
||
57 | static function isLoggedIn() |
||
73 | |||
74 | /** |
||
75 | * Get the currently logged in user |
||
76 | * |
||
77 | * @SuppressWarnings(PHPMD.Superglobals) |
||
78 | */ |
||
79 | static function getUser() |
||
100 | |||
101 | /** |
||
102 | * Set the currently logged in user |
||
103 | * |
||
104 | * @SuppressWarnings(PHPMD.Superglobals) |
||
105 | */ |
||
106 | static function setUser($user) |
||
110 | |||
111 | /** |
||
112 | * Obtain the current users email address |
||
113 | * |
||
114 | * @SuppressWarnings(PHPMD.Superglobals) |
||
115 | */ |
||
116 | static function getUserEmail() |
||
134 | |||
135 | /** |
||
136 | * This will end your session |
||
137 | * |
||
138 | * @SuppressWarnings(PHPMD.Superglobals) |
||
139 | */ |
||
140 | static function end() |
||
141 | { |
||
142 | if(isset($_SESSION) && !empty($_SESSION)) |
||
143 | { |
||
144 | $_SESSION = array(); |
||
145 | session_destroy(); |
||
146 | } |
||
147 | } |
||
148 | |||
149 | static function unserializePhpSession($sessionData) |
||
167 | |||
168 | static function getAllSessions() |
||
198 | |||
199 | static function getSessionById($sid) |
||
204 | |||
205 | static function deleteSessionById($sid) |
||
209 | } |
||
210 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
||
212 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.