SessionWrite::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace T4web\Authentication\Listener;
4
5
use Zend\Session\SessionManager;
6
use T4web\Authentication\AuthenticationEvent;
7
use T4web\Authentication\Exception\RuntimeException;
8
9
class SessionWrite
10
{
11
    /**
12
     * @var SessionManager
13
     */
14
    protected $sessionManager;
15
16
    /**
17
     * @param SessionManager $sessionManager
18
     * @throws RuntimeException
19
     */
20
    public function __construct(SessionManager $sessionManager)
21
    {
22
        $this->sessionManager = $sessionManager;
23
    }
24
25
    public function __invoke(AuthenticationEvent $e)
26
    {
27
        $result = $e->getResult();
28
29
        if ($result->isValid()) {
30
            $this->sessionManager->writeClose();
31
        }
32
    }
33
}
34