Passed
Push — master ( c0f6da...b424db )
by Jelmer
04:57
created

JwtSession   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 1
dl 0
loc 45
ccs 0
cts 31
cp 0
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A has() 0 4 1
A get() 0 4 1
A set() 0 4 1
A getFlash() 0 4 1
A setFlash() 0 4 1
A destroy() 0 4 1
A rotateId() 0 4 1
1
<?php declare(strict_types = 1);
2
3
namespace jschreuder\Middle\Session;
4
5
use PSR7Session\Session\SessionInterface as JwtSessionInterface;
6
7
class JwtSession implements SessionInterface
8
{
9
    /** @var  JwtSessionInterface */
10
    private $jwtSession;
11
12
    public function __construct(JwtSessionInterface $jwtSession)
13
    {
14
        $this->jwtSession = $jwtSession;
15
    }
16
17
    public function has(string $key) : bool
18
    {
19
        return $this->jwtSession->has($key);
20
    }
21
22
    public function get(string $key)
23
    {
24
        return $this->jwtSession->get($key);
25
    }
26
27
    public function set(string $key, $value)
28
    {
29
        $this->jwtSession->set($key, $value);
30
    }
31
32
    public function getFlash(string $key)
33
    {
34
        return $this->jwtSession->get($key);
35
    }
36
37
    public function setFlash(string $key, $value)
38
    {
39
        $this->jwtSession->set($key, $value);
40
    }
41
42
    public function destroy()
43
    {
44
        $this->jwtSession->clear();
45
    }
46
47
    public function rotateId()
48
    {
49
        // Does nothing with JWT based session, they don't have an ID
50
    }
51
}
52