Dummy   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 8
dl 0
loc 34
rs 10
c 1
b 0
f 0
ccs 0
cts 15
cp 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 3 1
A get() 0 7 2
A delete() 0 4 2
1
<?php
2
/**
3
 * SocialConnect project
4
 * @author: Patsura Dmitry https://github.com/ovr <[email protected]>
5
 */
6
declare(strict_types=1);
7
8
namespace SocialConnect\Provider\Session;
9
10
/**
11
 * You are not interested to use native PHP sessions and would like to mock without mocking in PHPUnit
12
 */
13
class Dummy implements SessionInterface
14
{
15
    protected $storage = [];
16
17
    /**
18
     * @param string $key
19
     *
20
     * @return mixed
21
     */
22
    public function get($key)
23
    {
24
        if (isset($this->storage[$key])) {
25
            return $this->storage[$key];
26
        }
27
28
        return null;
29
    }
30
31
    /**
32
     * @param string $key
33
     * @param mixed $value
34
     */
35
    public function set($key, $value)
36
    {
37
        $this->storage[$key] = $value;
38
    }
39
40
    /**
41
     * @param string $key
42
     */
43
    public function delete($key)
44
    {
45
        if (isset($this->storage[$key])) {
46
            unset($this->storage[$key]);
47
        }
48
    }
49
}
50