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

SessionHandler::exists()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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
}