Session   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A offsetUnset() 0 3 1
A offsetExists() 0 3 1
A offsetGet() 0 3 1
A offsetSet() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jasny\SSO\Broker;
6
7
/**
8
 * Use global $_SESSION to persist the client token.
9
 *
10
 * @implements \ArrayAccess<string,mixed>
11
 * @codeCoverageIgnore
12
 */
13
class Session implements \ArrayAccess
14
{
15
    /**
16
     * @inheritDoc
17
     */
18
    public function offsetSet($name, $value): void
19
    {
20
        $_SESSION[$name] = $value;
21
    }
22
23
    /**
24
     * @inheritDoc
25
     */
26
    public function offsetUnset($name): void
27
    {
28
        unset($_SESSION[$name]);
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function offsetGet($name)
0 ignored issues
show
introduced by
Return type of Jasny\SSO\Broker\Session::offsetGet($name) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Loading history...
35
    {
36
        return $_SESSION[$name] ?? null;
37
    }
38
39
    /**
40
     * @inheritDoc
41
     */
42
    public function offsetExists($name): bool
43
    {
44
        return isset($_SESSION[$name]);
45
    }
46
}
47