SessionStore::clear()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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