SessionHandler::exists()   A
last analyzed

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
use Core\Interfaces\AbstractSession;
14
15
class SessionHandler extends AbstractSession implements _Session
16
{
17
    public function get($key = null)
18
    {
19
        if(!isset($_SESSION)) return [];
20
21
        if(!$key){
22
            return $_SESSION;
23
        }else{
24
            $keys = explode('.',$key);
25
            $sessionVal = $this->getRecursiveSessionKey($_SESSION,$keys);
26
            return $sessionVal;
27
        }
28
    }
29
30
    public function set($key,$val)
31
    {
32
        $_SESSION = $this->setArr($key,$val);
33
    }
34
35
36
    public function exists($key,$val)
0 ignored issues
show
Unused Code introduced by
The parameter $val is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

36
    public function exists($key,/** @scrutinizer ignore-unused */ $val)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38
       $keySession = $this->get($key);
39
40
       if($keySession){
41
          return true;
42
       }
43
       return false;
44
    }
45
46
47
}