1 | <?php |
||
8 | class JwtSession implements SessionHandlerInterface |
||
9 | { |
||
10 | const COOKIE_PREFIX = "AUTH_BEARER_"; |
||
11 | |||
12 | /** |
||
13 | * @var SessionConfig |
||
14 | */ |
||
15 | protected $sessionConfig; |
||
16 | |||
17 | /** |
||
18 | * JwtSession constructor. |
||
19 | * |
||
20 | * @param $sessionConfig |
||
21 | * @throws JwtSessionException |
||
22 | */ |
||
23 | public function __construct($sessionConfig) |
||
37 | |||
38 | /** |
||
39 | * @param bool $startSession |
||
|
|||
40 | * @throws JwtSessionException |
||
41 | */ |
||
42 | protected function replaceSessionHandler() |
||
55 | |||
56 | /** |
||
57 | * Close the session |
||
58 | * |
||
59 | * @link http://php.net/manual/en/sessionhandlerinterface.close.php |
||
60 | * @return bool <p> |
||
61 | * The return value (usually TRUE on success, FALSE on failure). |
||
62 | * Note this value is returned internally to PHP for processing. |
||
63 | * </p> |
||
64 | * @since 5.4.0 |
||
65 | */ |
||
66 | public function close() |
||
70 | |||
71 | /** |
||
72 | * Destroy a session |
||
73 | * |
||
74 | * @link http://php.net/manual/en/sessionhandlerinterface.destroy.php |
||
75 | * @param string $session_id The session ID being destroyed. |
||
76 | * @return bool <p> |
||
77 | * The return value (usually TRUE on success, FALSE on failure). |
||
78 | * Note this value is returned internally to PHP for processing. |
||
79 | * </p> |
||
80 | * @since 5.4.0 |
||
81 | */ |
||
82 | public function destroy($session_id) |
||
96 | |||
97 | /** |
||
98 | * Cleanup old sessions |
||
99 | * |
||
100 | * @link http://php.net/manual/en/sessionhandlerinterface.gc.php |
||
101 | * @param int $maxlifetime <p> |
||
102 | * Sessions that have not updated for |
||
103 | * the last maxlifetime seconds will be removed. |
||
104 | * </p> |
||
105 | * @return bool <p> |
||
106 | * The return value (usually TRUE on success, FALSE on failure). |
||
107 | * Note this value is returned internally to PHP for processing. |
||
108 | * </p> |
||
109 | * @since 5.4.0 |
||
110 | */ |
||
111 | public function gc($maxlifetime) |
||
115 | |||
116 | /** |
||
117 | * Initialize session |
||
118 | * |
||
119 | * @link http://php.net/manual/en/sessionhandlerinterface.open.php |
||
120 | * @param string $save_path The path where to store/retrieve the session. |
||
121 | * @param string $name The session name. |
||
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 | public function open($save_path, $name) |
||
132 | |||
133 | /** |
||
134 | * Read session data |
||
135 | * |
||
136 | * @link http://php.net/manual/en/sessionhandlerinterface.read.php |
||
137 | * @param string $session_id The session id to read data for. |
||
138 | * @return string <p> |
||
139 | * Returns an encoded string of the read data. |
||
140 | * If nothing was read, it must return an empty string. |
||
141 | * Note this value is returned internally to PHP for processing. |
||
142 | * </p> |
||
143 | * @since 5.4.0 |
||
144 | */ |
||
145 | public function read($session_id) |
||
166 | |||
167 | /** |
||
168 | * Write session data |
||
169 | * |
||
170 | * @link http://php.net/manual/en/sessionhandlerinterface.write.php |
||
171 | * @param string $session_id The session id. |
||
172 | * @param string $session_data <p> |
||
173 | * The encoded session data. This data is the |
||
174 | * result of the PHP internally encoding |
||
175 | * the $_SESSION superglobal to a serialized |
||
176 | * string and passing it as this parameter. |
||
177 | * Please note sessions use an alternative serialization method. |
||
178 | * </p> |
||
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 \ByJG\Util\JwtWrapperException |
||
184 | * @since 5.4.0 |
||
185 | */ |
||
186 | public function write($session_id, $session_data) |
||
212 | |||
213 | public function serializeSessionData($array) |
||
222 | |||
223 | /** |
||
224 | * @param $session_data |
||
225 | * @return array |
||
226 | * @throws JwtSessionException |
||
227 | */ |
||
228 | public function unSerializeSessionData($session_data) |
||
247 | } |
||
248 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.