Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| AbstractHandler | |
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| open | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| close | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| gc | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| read | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
| write | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
| destroy | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Engelsystem\Http\SessionHandlers; |
| 6 | |
| 7 | use SessionHandlerInterface; |
| 8 | |
| 9 | abstract class AbstractHandler implements SessionHandlerInterface |
| 10 | { |
| 11 | protected string $name; |
| 12 | |
| 13 | protected string $sessionPath; |
| 14 | |
| 15 | /** |
| 16 | * Bootstrap the session handler |
| 17 | */ |
| 18 | public function open(string $path, string $name): bool |
| 19 | { |
| 20 | $this->name = $name; |
| 21 | $this->sessionPath = $path; |
| 22 | |
| 23 | return true; |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Shutdown the session handler |
| 28 | */ |
| 29 | public function close(): bool |
| 30 | { |
| 31 | return true; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Remove old sessions |
| 36 | */ |
| 37 | public function gc(int $max_lifetime): int|false |
| 38 | { |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Read session data |
| 44 | */ |
| 45 | abstract public function read(string $id): string; |
| 46 | |
| 47 | /** |
| 48 | * Write session data |
| 49 | */ |
| 50 | abstract public function write(string $id, string $data): bool; |
| 51 | |
| 52 | /** |
| 53 | * Delete a session |
| 54 | */ |
| 55 | abstract public function destroy(string $id): bool; |
| 56 | } |