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 — feature/tweak ( 28e05b )
by jake
02:03
created

Storage::getCurrent()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
// @codingStandardsIgnoreFile
3
4
namespace Jnjxp\Molniya\Session;
5
6
use Jnjxp\Molniya\StorageInterface;
7
use Jnjxp\Molniya\Messenger;
8
use Psr\Http\Message\ServerRequestInterface as Request;
9
use Vperyod\SessionHandler\SessionAwareTrait;
10
11
class Storage implements StorageInterface
12
{
13
    use SessionAwareTrait;
14
15
    const SEGMENT = self::class;
16
    const MESSAGE_KEY = self::class . '::MESSAGE_KEY';
17
18
    protected $current;
19
20
    public function read(Request $request) : void
21
    {
22
        $segment = $this->getSegment($request);
23
        $current = $segment->getFlash(self::MESSAGE_KEY, null);
24
        $this->current = $current ?? new Messenger\Messenger;
25
    }
26
27
    public function newMessenger(Request $request) : Messenger\MessengerInterface
28
    {
29
        $segment   = $this->getSegment($request);
30
        $messenger = new Messenger\Messenger;
31
        $segment->setFlash(self::MESSAGE_KEY, $messenger);
32
        return $messenger;
33
    }
34
35
    public function getCurrent() : Messenger\MessengerInterface
36
    {
37
        if (! $this->current) {
38
            throw new \Exception('No current!');
39
        }
40
41
        return $this->current;
42
    }
43
44
    public function getSegment(Request $request)
45
    {
46
        return $this->getSessionSegment($request, self::SEGMENT);
47
    }
48
49
50
}
51