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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 42
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A set() 0 4 1
A has() 0 4 1
A get() 0 4 1
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