1 | <?php |
||
9 | class Coossions extends Encryptor implements BaseInterface |
||
10 | { |
||
11 | private $sidLength = 0; |
||
12 | private $sessionNameLength = 0; |
||
13 | private $cookieParams = []; |
||
14 | |||
15 | private $isOpened = false; |
||
16 | |||
17 | /** |
||
18 | * Coossions constructor. |
||
19 | * @param string $secret the secret key to be used in openssl_digest |
||
20 | */ |
||
21 | 2 | public function __construct(string $secret) |
|
29 | |||
30 | /** |
||
31 | * Setter for DI via Encryptor ex. if user wants to override params |
||
32 | * |
||
33 | * @param Encryptor $encryptor |
||
34 | * @throws AlgoNotFoundException |
||
35 | */ |
||
36 | 1 | public function setEncryption(Encryptor $encryptor) |
|
56 | |||
57 | /** |
||
58 | * Close the session |
||
59 | * |
||
60 | * @link http://php.net/manual/en/sessionhandlerinterface.close.php |
||
61 | * @return bool <p> |
||
62 | * The return value (usually TRUE on success, FALSE on failure). |
||
63 | * Note this value is returned internally to PHP for processing. |
||
64 | * </p> |
||
65 | * @since 5.4.0 |
||
66 | */ |
||
67 | 1 | public function close(): bool |
|
71 | |||
72 | /** |
||
73 | * Destroy a session |
||
74 | * |
||
75 | * @link http://php.net/manual/en/sessionhandlerinterface.destroy.php |
||
76 | * |
||
77 | * @param string $sid The session ID being destroyed. |
||
78 | * |
||
79 | * @return bool <p> |
||
80 | * The return value (usually TRUE on success, FALSE on failure). |
||
81 | * Note this value is returned internally to PHP for processing. |
||
82 | * </p> |
||
83 | * @since 5.4.0 |
||
84 | */ |
||
85 | 1 | public function destroy($sid): bool |
|
92 | |||
93 | /** |
||
94 | * Cleanup old sessions |
||
95 | * |
||
96 | * @link http://php.net/manual/en/sessionhandlerinterface.gc.php |
||
97 | * |
||
98 | * @param int $maxlifetime <p> |
||
99 | * Sessions that have not updated for |
||
100 | * the last maxlifetime seconds will be removed. |
||
101 | * </p> |
||
102 | * |
||
103 | * @return bool <p> |
||
104 | * The return value (usually TRUE on success, FALSE on failure). |
||
105 | * Note this value is returned internally to PHP for processing. |
||
106 | * </p> |
||
107 | * @since 5.4.0 |
||
108 | */ |
||
109 | 1 | public function gc($maxlifetime): bool |
|
113 | |||
114 | /** |
||
115 | * Initialize session |
||
116 | * |
||
117 | * @link http://php.net/manual/en/sessionhandlerinterface.open.php |
||
118 | * |
||
119 | * @param string $savePath The path where to store/retrieve the session. |
||
120 | * @param string $sid The session id. |
||
121 | * |
||
122 | * @return bool <p> |
||
123 | * The return value (usually TRUE on success, FALSE on failure). |
||
124 | * Note this value is returned internally to PHP for processing. |
||
125 | * </p> |
||
126 | * @since 5.4.0 |
||
127 | */ |
||
128 | 1 | public function open($savePath, $sid): bool |
|
138 | |||
139 | /** |
||
140 | * Read session data |
||
141 | * |
||
142 | * @link http://php.net/manual/en/sessionhandlerinterface.read.php |
||
143 | * |
||
144 | * @param string $sid The session id to read data for. |
||
145 | * |
||
146 | * @return string <p> |
||
147 | * Returns an encoded string of the read data. |
||
148 | * If nothing was read, it must return an empty string. |
||
149 | * Note this value is returned internally to PHP for processing. |
||
150 | * </p> |
||
151 | * @since 5.4.0 |
||
152 | */ |
||
153 | 1 | public function read($sid): string |
|
164 | |||
165 | /** |
||
166 | * Write session data |
||
167 | * |
||
168 | * @link http://php.net/manual/en/sessionhandlerinterface.write.php |
||
169 | * |
||
170 | * @param string $sid The session id. |
||
171 | * @param string $sessionData <p> |
||
172 | * The encoded session data. This data is the |
||
173 | * result of the PHP internally encoding |
||
174 | * the $_SESSION superglobal to a serialized |
||
175 | * string and passing it as this parameter. |
||
176 | * Please note sessions use an alternative serialization method. |
||
177 | * </p> |
||
178 | * |
||
179 | * @return bool <p> |
||
180 | * The return value (usually TRUE on success, FALSE on failure). |
||
181 | * Note this value is returned internally to PHP for processing. |
||
182 | * </p> |
||
183 | * @throws CookieSizeException |
||
184 | * @throws OpenSSLException |
||
185 | * @since 5.4.0 |
||
186 | */ |
||
187 | 1 | public function write($sid, $sessionData): bool |
|
215 | } |