Total Complexity | 13 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Coverage | 8.11% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
6 | class Session extends Service implements Interfaces\ISession |
||
7 | { |
||
8 | protected $parametersList = ['type']; |
||
9 | private static $container; |
||
10 | |||
11 | |||
12 | 1 | protected function init() |
|
13 | { |
||
14 | 1 | if (self::$container === null) { |
|
15 | switch ($this->type) { |
||
|
|||
16 | case 'native': |
||
17 | self::$container = Suricate::SessionNative(true); |
||
18 | break; |
||
19 | case 'cookie': |
||
20 | self::$container = Suricate::SessionCookie(true); |
||
21 | break; |
||
22 | case 'memcache': |
||
23 | self::$container = Suricate::SessionMemcache(true); |
||
24 | break; |
||
25 | case 'none': |
||
26 | break; |
||
27 | default: |
||
28 | throw new Exception("Unknown session type " . $this->type); |
||
29 | } |
||
30 | } |
||
31 | 1 | } |
|
32 | |||
33 | /** |
||
34 | * Get instance of session driver used |
||
35 | * @return Sessiondriver instance |
||
36 | */ |
||
37 | public function getInstance() |
||
41 | } |
||
42 | |||
43 | public function getId() |
||
44 | { |
||
45 | $this->init(); |
||
46 | return self::$container->getId(); |
||
47 | } |
||
48 | public function regenerate() |
||
49 | { |
||
50 | $this->init(); |
||
51 | return self::$container->regenerate(); |
||
52 | } |
||
53 | |||
54 | public function read($key) |
||
55 | { |
||
56 | $this->init(); |
||
57 | return self::$container->read($key); |
||
58 | } |
||
59 | |||
60 | public function write($key, $data) |
||
64 | } |
||
65 | |||
66 | public function destroy($key) |
||
70 | } |
||
71 | |||
72 | public function close() |
||
76 | } |
||
77 | } |
||
78 |