1 | <?php |
||
44 | class Payload |
||
45 | { |
||
46 | /** |
||
47 | * The session array that is stored by the storage. |
||
48 | * |
||
49 | * @var array|null |
||
50 | */ |
||
51 | public $session; |
||
52 | |||
53 | /** |
||
54 | * The session storage used to retrieve and store the session payload. |
||
55 | * |
||
56 | * @var \Pimf\Session\Storages\Storage |
||
57 | */ |
||
58 | public $storage; |
||
59 | |||
60 | /** |
||
61 | * Indicates if the session already exists in storage. |
||
62 | * |
||
63 | * @var bool |
||
64 | */ |
||
65 | public $exists = true; |
||
66 | |||
67 | /** |
||
68 | * @param Storages\Storage $storage |
||
69 | */ |
||
70 | public function __construct(\Pimf\Session\Storages\Storage $storage) |
||
74 | |||
75 | /** |
||
76 | * Load the session for the current request. |
||
77 | * |
||
78 | * @param null|string $key |
||
79 | */ |
||
80 | public function load($key) |
||
98 | |||
99 | /** |
||
100 | * Determine if the session payload instance is valid. |
||
101 | * |
||
102 | * @param array $session |
||
103 | * |
||
104 | * @return bool |
||
105 | */ |
||
106 | protected static function expired($session) |
||
114 | |||
115 | /** |
||
116 | * Determine if the session or flash data contains an item. |
||
117 | * |
||
118 | * @param string $key |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | public function has($key) |
||
126 | |||
127 | /** |
||
128 | * Get an item from the session. |
||
129 | * |
||
130 | * @param string $key |
||
131 | * @param null $default |
||
132 | * |
||
133 | * @return mixed|null |
||
134 | */ |
||
135 | public function get($key, $default = null) |
||
156 | |||
157 | /** |
||
158 | * Checks if key is in session. |
||
159 | * |
||
160 | * @param string $key |
||
161 | * @param array $session |
||
162 | * |
||
163 | * @return mixed|null |
||
164 | */ |
||
165 | protected function isIn($key, array $session) |
||
173 | |||
174 | /** |
||
175 | * Write an item to the session. |
||
176 | * |
||
177 | * @param $key |
||
178 | * @param string $value |
||
179 | */ |
||
180 | public function put($key, $value) |
||
184 | |||
185 | /** |
||
186 | * Write an item to the session flash data. |
||
187 | * |
||
188 | * @param $key |
||
189 | * @param $value |
||
190 | */ |
||
191 | public function flash($key, $value) |
||
195 | |||
196 | /** |
||
197 | * Keep all of the session flash data from expiring after the request. |
||
198 | * |
||
199 | * @return void |
||
200 | */ |
||
201 | public function reflash() |
||
207 | |||
208 | /** |
||
209 | * Keep a session flash item from expiring at the end of the request. |
||
210 | * |
||
211 | * @param $keys |
||
212 | */ |
||
213 | public function keep($keys) |
||
219 | |||
220 | /** |
||
221 | * Remove an item from the session data. |
||
222 | * |
||
223 | * @param $key |
||
224 | */ |
||
225 | public function forget($key) |
||
229 | |||
230 | /** |
||
231 | * Remove all of the items from the session (CSRF token will not be removed). |
||
232 | */ |
||
233 | public function flush() |
||
237 | |||
238 | /** |
||
239 | * Assign a new, random ID to the session. |
||
240 | */ |
||
241 | public function regenerate() |
||
246 | |||
247 | /** |
||
248 | * Get the CSRF token that is stored in the session data. |
||
249 | * |
||
250 | * @return string |
||
251 | */ |
||
252 | public function token() |
||
256 | |||
257 | /** |
||
258 | * Get the last activity for the session. |
||
259 | * |
||
260 | * @return int |
||
261 | */ |
||
262 | public function activity() |
||
266 | |||
267 | /** |
||
268 | * Store the session payload in storage. |
||
269 | * This method will be called automatically at the end of the request. |
||
270 | * |
||
271 | * @return void |
||
272 | */ |
||
273 | public function save() |
||
296 | |||
297 | /** |
||
298 | * Clean up expired sessions. |
||
299 | * |
||
300 | * @return void |
||
301 | */ |
||
302 | public function clean() |
||
308 | |||
309 | /** |
||
310 | * Age the session flash data. |
||
311 | * |
||
312 | * @return void |
||
313 | */ |
||
314 | protected function age() |
||
319 | |||
320 | /** |
||
321 | * Send the session ID cookie to the browser. |
||
322 | * |
||
323 | * @param array $config |
||
324 | * |
||
325 | * @return void |
||
326 | */ |
||
327 | protected function cookie($config) |
||
334 | } |
||
335 |