Session.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 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 
13 /**
14  * Session is the interface for session implementations
15  * and defines access to session variables.
16  *
17  * @author ingo herwig <ingo@wemove.com>
18  */
19 interface Session {
20 
21  /**
22  * Check if the session is started.
23  * @return Boolean.
24  */
25  public function isStarted();
26 
27  /**
28  * Get the id of the session.
29  * @return The id of the current session.
30  */
31  public function getID();
32 
33  /**
34  * Returns the value of a session variable
35  * @param $key The key (name) of the session vaiable.
36  * @param $default The default value if the key is not defined (optional, default: _null_)
37  * @return The session var or null if it doesn't exist.
38  */
39  public function get($key, $default=null);
40 
41  /**
42  * Sets the value of a session variable.
43  * @param $key The key (name) of the session vaiable.
44  * @param $value The value of the session variable.
45  */
46  public function set($key, $value);
47 
48  /**
49  * Remove a session variable.
50  * @param $key The key (name) of the session variable.
51  */
52  public function remove($key);
53 
54  /**
55  * Tests, if a certain session variable is defined.
56  * @param $key The key (name) of the session variable.
57  * @return Boolean whether the session variable is set or not.
58  */
59  public function exist($key);
60 
61  /**
62  * Clear the session data.
63  */
64  public function clear();
65 
66  /**
67  * Destroy the session.
68  */
69  public function destroy();
70 
71  /**
72  * Set the login of authenticated user.
73  * @param $login Login name of the user
74  */
75  public function setAuthUser($login);
76 
77  /**
78  * Get the login of the authenticated user.
79  * @return String
80  */
81  public function getAuthUser();
82 }
Session is the interface for session implementations and defines access to session variables.
Definition: Session.php:19
getAuthUser()
Get the login of the authenticated user.
getID()
Get the id of the session.
exist($key)
Tests, if a certain session variable is defined.
destroy()
Destroy the session.
Core classes.
Definition: namespaces.php:11
setAuthUser($login)
Set the login of authenticated user.
clear()
Clear the session data.
isStarted()
Check if the session is started.