AuthSession   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 42
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setState() 0 3 1
A setNonce() 0 3 1
A getState() 0 3 1
A fromArray() 0 7 1
A getNonce() 0 3 1
A jsonSerialize() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TMV\OpenIdClient\Session;
6
7
use function array_filter;
8
9
final class AuthSession implements AuthSessionInterface
10
{
11
    /** @var null|string */
12
    private $state;
13
14
    /** @var null|string */
15
    private $nonce;
16
17 3
    public function getState(): ?string
18
    {
19 3
        return $this->state;
20
    }
21
22 3
    public function getNonce(): ?string
23
    {
24 3
        return $this->nonce;
25
    }
26
27 3
    public function setState(?string $state): void
28
    {
29 3
        $this->state = $state;
30 3
    }
31
32 3
    public function setNonce(?string $nonce): void
33
    {
34 3
        $this->nonce = $nonce;
35 3
    }
36
37 2
    public static function fromArray(array $array): AuthSessionInterface
38
    {
39 2
        $session = new self();
40 2
        $session->setState($array['state'] ?? null);
41 2
        $session->setNonce($array['nonce'] ?? null);
42
43 2
        return $session;
44
    }
45
46 1
    public function jsonSerialize(): array
47
    {
48 1
        return array_filter([
49 1
            'state' => $this->getState(),
50 1
            'nonce' => $this->getNonce(),
51
        ]);
52
    }
53
}
54