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