| Total Complexity | 12 | 
| Total Lines | 74 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 11 | class Session implements interfaces\SessionInterface  | 
            ||
| 12 | { | 
            ||
| 13 | /**  | 
            ||
| 14 | * @param string $key  | 
            ||
| 15 | * @return mixed|null  | 
            ||
| 16 | */  | 
            ||
| 17 | public function get(string $key)  | 
            ||
| 18 |     { | 
            ||
| 19 |         if (session_status() != \PHP_SESSION_ACTIVE) { | 
            ||
| 20 | session_start();  | 
            ||
| 21 | }  | 
            ||
| 22 |         if (isset($_SESSION[$key])) { | 
            ||
| 23 | return $_SESSION[$key];  | 
            ||
| 24 | }  | 
            ||
| 25 |         if (strpos($key, '.') !== false) { | 
            ||
| 26 | return Util::getFromArrayByKey($key, $_SESSION);  | 
            ||
| 27 | }  | 
            ||
| 28 | return null;  | 
            ||
| 29 | }  | 
            ||
| 30 | |||
| 31 | /**  | 
            ||
| 32 | * @param string $key  | 
            ||
| 33 | * @param $value  | 
            ||
| 34 | * @throws \Error if trying to set with dot notation  | 
            ||
| 35 | */  | 
            ||
| 36 | public function set(string $key, $value): void  | 
            ||
| 37 |     { | 
            ||
| 38 |         if ($this->active() === false) { | 
            ||
| 39 | session_start();  | 
            ||
| 40 | }  | 
            ||
| 41 |         if (strpos($key, '.') !== false) { | 
            ||
| 42 |             throw new \Error("Dot notation setting of Session values not implemented yet"); | 
            ||
| 43 | }  | 
            ||
| 44 | $_SESSION[$key] = $value;  | 
            ||
| 45 | }  | 
            ||
| 46 | |||
| 47 | /**  | 
            ||
| 48 | * @param string $key  | 
            ||
| 49 | */  | 
            ||
| 50 | public function unset(string $key): void  | 
            ||
| 53 | }  | 
            ||
| 54 | |||
| 55 | /**  | 
            ||
| 56 | * @return bool  | 
            ||
| 57 | */  | 
            ||
| 58 | private function active(): bool  | 
            ||
| 59 |     { | 
            ||
| 60 | return session_status() === \PHP_SESSION_ACTIVE;  | 
            ||
| 61 | }  | 
            ||
| 62 | |||
| 63 | /**  | 
            ||
| 64 | * @return bool  | 
            ||
| 65 | */  | 
            ||
| 66 | public function destroy(): bool  | 
            ||
| 76 | }  | 
            ||
| 77 | |||
| 78 | /**  | 
            ||
| 79 | * @param string $key  | 
            ||
| 80 | * @return bool  | 
            ||
| 81 | */  | 
            ||
| 82 | public function check(string $key): bool  | 
            ||
| 85 | }  | 
            ||
| 86 | }  | 
            ||
| 87 |