Completed
Push — master ( a7db3c...a6cff5 )
by Afshin
02:21
created

SessionHandler   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 10 3
A set() 0 3 1
A exists() 0 8 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: afshin
5
 * Date: 12/8/17
6
 * Time: 1:04 AM
7
 */
8
9
namespace Core\Handlers\Session;
10
11
12
use Core\Interfaces\_Session;
13
14
class SessionHandler extends SessionInterface implements _Session
0 ignored issues
show
Bug introduced by
The type Core\Handlers\Session\SessionInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
{
16
    public function get($key = null)
17
    {
18
        if(!isset($_SESSION)) return [];
19
20
        if(!$key){
21
            return $_SESSION;
22
        }else{
23
            $keys = explode('.',$key);
24
            $sessionVal = $this->getRecursiveSessionKey($_SESSION,$keys);
25
            return $sessionVal;
26
        }
27
    }
28
29
    public function set($key,$val)
30
    {
31
        $_SESSION = $this->setArr($key,$val);
32
    }
33
34
35
    public function exists($key,$val)
36
    {
37
       $keySession = $this->get($key);
38
39
       if($keySession){
40
          return true;
41
       }
42
       return false;
43
    }
44
45
46
}