]> git.mxchange.org Git - friendica.git/blob - src/Core/Session/ISession.php
Merge pull request #7907 from nupplaphil/task/reduce_app_deps
[friendica.git] / src / Core / Session / ISession.php
1 <?php
2
3 namespace Friendica\Core\Session;
4
5 /**
6  * Contains all global supported Session methods
7  */
8 interface ISession
9 {
10         /**
11          * Start the current session
12          *
13          * @return self The own Session instance
14          */
15         public function start();
16
17         /**
18          * Checks if the key exists in this session
19          *
20          * @param string $name
21          *
22          * @return boolean True, if it exists
23          */
24         public function exists(string $name);
25
26         /**
27          * Retrieves a key from the session super global or the defaults if the key is missing or the value is falsy.
28          *
29          * Handle the case where session_start() hasn't been called and the super global isn't available.
30          *
31          * @param string $name
32          * @param mixed  $defaults
33          *
34          * @return mixed
35          */
36         public function get(string $name, $defaults = null);
37
38         /**
39          * Sets a single session variable.
40          * Overrides value of existing key.
41          *
42          * @param string $name
43          * @param mixed  $value
44          */
45         public function set(string $name, $value);
46
47         /**
48          * Sets multiple session variables.
49          * Overrides values for existing keys.
50          *
51          * @param array $values
52          */
53         public function setMultiple(array $values);
54
55         /**
56          * Removes a session variable.
57          * Ignores missing keys.
58          *
59          * @param string $name
60          */
61         public function remove(string $name);
62
63         /**
64          * Clears the current session array
65          */
66         public function clear();
67 }