Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * Jingga |
4 | * |
5 | * PHP Version 8.1 |
6 | * |
7 | * @package phpOMS\DataStorage\Session |
8 | * @copyright Dennis Eichhorn |
9 | * @license OMS License 2.0 |
10 | * @version 1.0.0 |
11 | * @link https://jingga.app |
12 | */ |
13 | declare(strict_types=1); |
14 | |
15 | namespace phpOMS\DataStorage\Session; |
16 | |
17 | /** |
18 | * Session interface. |
19 | * |
20 | * Sessions can be used by http requests, console interaction and socket connections |
21 | * |
22 | * @package phpOMS\DataStorage\Session |
23 | * @license OMS License 2.0 |
24 | * @link https://jingga.app |
25 | * @since 1.0.0 |
26 | * |
27 | * @property array $data |
28 | */ |
29 | interface SessionInterface |
30 | { |
31 | /** |
32 | * Get session variable by key. |
33 | * |
34 | * @param string $key Value key |
35 | * |
36 | * @return mixed |
37 | * |
38 | * @since 1.0.0 |
39 | */ |
40 | public function get(string $key) : mixed; |
41 | |
42 | /** |
43 | * Store session value by key. |
44 | * |
45 | * @param string $key Value key |
46 | * @param mixed $value Value to store |
47 | * @param bool $overwrite Overwrite existing values |
48 | * |
49 | * @return bool |
50 | * |
51 | * @since 1.0.0 |
52 | */ |
53 | public function set(string $key, mixed $value, bool $overwrite = false) : bool; |
54 | |
55 | /** |
56 | * Remove value from session by key. |
57 | * |
58 | * @param string $key Value key |
59 | * |
60 | * @return bool |
61 | * |
62 | * @since 1.0.0 |
63 | */ |
64 | public function remove(string $key) : bool; |
65 | |
66 | /** |
67 | * Save session. |
68 | * |
69 | * @return bool |
70 | * |
71 | * @since 1.0.0 |
72 | */ |
73 | public function save() : bool; |
74 | |
75 | /** |
76 | * @return string |
77 | * |
78 | * @since 1.0.0 |
79 | */ |
80 | public function getSID() : string; |
81 | |
82 | /** |
83 | * @param string $sid Session id |
84 | * |
85 | * @return void |
86 | * |
87 | * @since 1.0.0 |
88 | */ |
89 | public function setSID(string $sid) : void; |
90 | |
91 | /** |
92 | * Lock session from further adjustments. |
93 | * |
94 | * @return void |
95 | * |
96 | * @since 1.0.0 |
97 | */ |
98 | public function lock() : void; |
99 | } |