Completed
Push — master ( 868034...401fc2 )
by Дмитрий
03:17
created

Session   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 40
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 8 2
A set() 0 4 1
A delete() 0 6 2
1
<?php
2
/**
3
 * @author Patsura Dmitry https://github.com/ovr <[email protected]>
4
 */
5
6
namespace SocialConnect\Provider\Session;
7
8
class Session implements SessionInterface
9
{
10
    public function __construct()
11
    {
12
        session_start();
13
    }
14
15
    /**
16
     * @param string $key
17
     *
18
     * @return mixed
19
     */
20
    public function get($key)
21
    {
22
        if (isset($_SESSION[$key])) {
23
            return $_SESSION[$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
        $_SESSION[$key] = $value;
36
    }
37
38
    /**
39
     * @param string $key
40
     */
41
    public function delete($key)
42
    {
43
        if (isset($_SESSION[$key])) {
44
            unset($_SESSION[$key]);
45
        }
46
    }
47
}
48