1 | <?php |
||
4 | class NativeSession implements StorageInterface |
||
5 | { |
||
6 | /** |
||
7 | * @var string |
||
8 | */ |
||
9 | private $namespace; |
||
10 | |||
11 | /** |
||
12 | * NativeSession constructor. |
||
13 | * @param string $namespace |
||
14 | */ |
||
15 | 4 | public function __construct($namespace = 'golem_auth') |
|
19 | |||
20 | /** |
||
21 | * Stores identity |
||
22 | * @param int|string $id |
||
23 | */ |
||
24 | 3 | public function store($id) |
|
28 | |||
29 | /** |
||
30 | * Returns identity |
||
31 | * @return int|string|null |
||
32 | */ |
||
33 | 2 | public function read() |
|
40 | |||
41 | /** |
||
42 | * @return bool |
||
43 | */ |
||
44 | 4 | public function exists() |
|
48 | |||
49 | /** |
||
50 | * Clears out identity |
||
51 | */ |
||
52 | 1 | public function clear() |
|
56 | } |
||
57 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: