Session.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2015 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\core;
12 
14 
15 /**
16  * Session is the interface for session implementations
17  * and defines access to session variables.
18  *
19  * @author ingo herwig <ingo@wemove.com>
20  */
21 interface Session {
22 
23  /**
24  * Get the id of the session.
25  * @return The id of the current session.
26  */
27  public function getID();
28 
29  /**
30  * Returns the value of an session variable
31  * @param $key The key (name) of the session vaiable.
32  * @return The session var or null if it doesn't exist.
33  */
34  public function get($key);
35 
36  /**
37  * Sets the value of an session variable.
38  * @param $key The key (name) of the session vaiable.
39  * @param $value The value of the session variable.
40  */
41  public function set($key, $value);
42 
43  /**
44  * Remove a session variable.
45  * @param $key The key (name) of the session variable.
46  */
47  public function remove($key);
48 
49  /**
50  * Tests, if a certain session variable is defined.
51  * @param $key The key (name) of the session variable.
52  * @return Boolean whether the session variable is set or not.
53  */
54  public function exist($key);
55 
56  /**
57  * Clear the session data.
58  */
59  public function clear();
60 
61  /**
62  * Destroy the session.
63  */
64  public function destroy();
65 
66  /**
67  * Set the authenticated user.
68  * @param $authUser User instance.
69  */
70  public function setAuthUser(User $authUser);
71 
72  /**
73  * Get the authenticated user.
74  * @return User instance.
75  */
76  public function getAuthUser();
77 
78  /**
79  * Add an error to the session data.
80  * @param $key The identifier of the error
81  * @param $error The error message
82  */
83  public function addError($key, $error);
84 
85  /**
86  * Get an error stored in the session data.
87  * @param $key The identifier of the error
88  * @return The error message
89  */
90  public function getError($key);
91 
92  /**
93  * Get all errors stored in the session data.
94  * @return The error message
95  */
96  public function getErrors();
97 
98  /**
99  * Clear the session error data.
100  */
101  public function clearErrors();
102 }
getID()
Get the id of the session.
setAuthUser(User $authUser)
Set the authenticated user.
User is the interface for users.
Definition: User.php:18
getError($key)
Get an error stored in the session data.
getAuthUser()
Get the authenticated user.
clear()
Clear the session data.
addError($key, $error)
Add an error to the session data.
Session is the interface for session implementations and defines access to session variables...
Definition: Session.php:21
exist($key)
Tests, if a certain session variable is defined.
getErrors()
Get all errors stored in the session data.
clearErrors()
Clear the session error data.
set($key, $value)
Sets the value of an session variable.
destroy()
Destroy the session.
Core classes.
Definition: namespaces.php:11