GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 3.x ( 854d93...81f322 )
by Jindřich
01:52
created

SessionAdapter::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Skautis\SessionAdapter;
5
6
/**
7
 * Adapter pro pouziti $_SESSION ve SkautISu
8
 */
9
class SessionAdapter implements AdapterInterface
10
{
11
12
    /**
13
     * @var array
14
     */
15
    protected $session;
16
17 2
    public function __construct()
18
    {
19 2
      $sessionId = '__' . __CLASS__;
20 2
      if (!isset($_SESSION[$sessionId])) {
21 1
            $_SESSION[$sessionId] = [];
22
      }
23
24 2
        $this->session = &$_SESSION[$sessionId];
25 2
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30 2
    public function set(string $name, $object): void
31
    {
32 2
        $this->session[$name] = $object;
33 2
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38 3
    public function has(string $name): bool
39
    {
40 3
        return isset($this->session[$name]);
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46 2
    public function get(string $name)
47
    {
48 2
        return $this->session[$name];
49
    }
50
}
51