SessionStore   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSession() 0 3 1
A setSession() 0 3 1
A getLifetime() 0 9 2
A clear() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Alpha\VisitorTrackingBundle\Storage;
6
7
use Alpha\VisitorTrackingBundle\Entity\Lifetime;
8
use Alpha\VisitorTrackingBundle\Entity\Session;
9
10
class SessionStore
11
{
12
    /**
13
     * @var Session|null
14
     */
15
    private $session;
16
17
    public function clear(): void
18
    {
19
        $this->session = null;
20
    }
21
22
    public function setSession(Session $session): void
23
    {
24
        $this->session = $session;
25
    }
26
27
    public function getSession(): ?Session
28
    {
29
        return $this->session;
30
    }
31
32
    public function getLifetime(): ?Lifetime
33
    {
34
        $session = $this->getSession();
35
36
        if ($session === null) {
37
            return null;
38
        }
39
40
        return $session->getLifetime();
41
    }
42
}
43