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 — master ( c0d893...b5b87f )
by James
05:14
created

Session::sessionForget()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 6
cp 0.8333
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.0185
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PragmaRX\Google2FALaravel\Support;
6
7
/**
8
 * Trait Session
9
 */
10
trait Session
11
{
12
    /**
13
     * Flag to disable the session for API usage.
14
     *
15
     * @var bool
16
     */
17
    protected $stateless = false;
18
19
    /**
20
     * Make a session var name for.
21
     *
22
     * @param null $name
23
     *
24
     * @return mixed
25
     */
26 8
    protected function makeSessionVarName($name = null)
27
    {
28 8
        return $this->config('session_var').(is_null($name) || empty($name) ? '' : '.'.$name);
29
    }
30
31
    /**
32
     * Get a session var value.
33
     *
34
     * @param null $var
35
     *
36
     * @return mixed
37
     */
38 7
    public function sessionGet($var = null, $default = null)
39
    {
40 7
        if ($this->stateless) {
41
            return $default;
42
        }
43
44 7
        return $this->getRequest()->session()->get(
45 7
            $this->makeSessionVarName($var),
46
            $default
47
        );
48
    }
49
50
    /**
51
     * Put a var value to the current session.
52
     *
53
     * @param $var
54
     * @param $value
55
     *
56
     * @return mixed
57
     */
58 5
    protected function sessionPut($var, $value)
59
    {
60 5
        if ($this->stateless) {
61
            return $value;
62
        }
63
64 5
        $this->getRequest()->session()->put(
65 5
            $this->makeSessionVarName($var),
66
            $value
67
        );
68
69 5
        return $value;
70
    }
71
72
    /**
73
     * Forget a session var.
74
     *
75
     * @param null $var
76
     */
77 3
    protected function sessionForget($var = null)
78
    {
79 3
        if ($this->stateless) {
80
            return;
81
        }
82
83 3
        $this->getRequest()->session()->forget(
84 3
            $this->makeSessionVarName($var)
85
        );
86 3
    }
87
88
    /**
89
     * @param mixed $stateless
90
     *
91
     * @return Authenticator
92
     */
93
    public function setStateless($stateless = true)
94
    {
95
        $this->stateless = $stateless;
96
97
        return $this;
98
    }
99
100
    abstract protected function config($string, $children = []);
101
102
    /**
103
     * @return \Illuminate\Http\Request
104
     */
105
    abstract public function getRequest();
106
}
107