1 | <?php |
||
11 | class SessionHelper { |
||
12 | |||
13 | const SESSION_STORAGE = 'data-tables.'; |
||
14 | |||
15 | /** @var Request */ |
||
16 | private $_request; |
||
17 | |||
18 | /** |
||
19 | * SessionHelper constructor. |
||
20 | * @param Request $request |
||
21 | */ |
||
22 | 31 | public function __construct(Request $request) |
|
26 | |||
27 | /** |
||
28 | * Save the state for the given key. |
||
29 | * |
||
30 | * @param string $key |
||
31 | * @param mixed $sessionValue |
||
32 | */ |
||
33 | 2 | public function saveState(string $key, $sessionValue) |
|
37 | |||
38 | /** |
||
39 | * @param string $key |
||
40 | * @return string |
||
41 | */ |
||
42 | 3 | private function _getFormattedKey(string $key) : string |
|
53 | |||
54 | /** |
||
55 | * Get the state for the given key. |
||
56 | * |
||
57 | * @param string $key |
||
58 | * @param null $default |
||
59 | * @return mixed |
||
60 | */ |
||
61 | 3 | public function getState(string $key, $default = null) |
|
65 | |||
66 | /** |
||
67 | * Remove the state for the given key. |
||
68 | * |
||
69 | * @param string $key |
||
70 | */ |
||
71 | 1 | public function removeState(string $key) |
|
75 | } |