Completed
Push — master ( c492ef...aefc68 )
by Дмитрий
01:55
created

Dummy::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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