Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
MemorySession | |
0.00% |
0 / 7 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 1 |
resetConfigure | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
has | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
get | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
set | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
delete | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
clear | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Utils; |
4 | |
5 | class MemorySession extends AbstractSession { |
6 | /** @var array<string, ?string> */ |
7 | public array $session_storage = []; |
8 | public bool $cleared = false; |
9 | |
10 | /** @param array{timeout?: int} $config */ |
11 | public function resetConfigure(array $config): void { |
12 | $this->clear(); |
13 | } |
14 | |
15 | public function has(string $key): bool { |
16 | return isset($this->session_storage[$key]); |
17 | } |
18 | |
19 | public function get(string $key): ?string { |
20 | return $this->session_storage[$key] ?? null; |
21 | } |
22 | |
23 | public function set(string $key, ?string $new_value): void { |
24 | $this->session_storage[$key] = $new_value; |
25 | } |
26 | |
27 | public function delete(string $key): void { |
28 | unset($this->session_storage[$key]); |
29 | } |
30 | |
31 | public function clear(): void { |
32 | $this->session_storage = []; |
33 | $this->cleared = true; |
34 | } |
35 | } |