Test Failed
Push — master ( 31c635...ef6440 )
by Paul
07:17 queued 01:32
created

Session::sessionGet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace GeminiLabs\SiteReviews;
4
5
use GeminiLabs\SiteReviews\Helpers\Arr;
6
7
trait Session
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $session = [];
13
14
    /**
15
     * @return Arguments
16
     */
17
    public function session()
18
    {
19
        return glsr()->args($this->session);
20
    }
21
22
    /**
23
     * @return void
24
     */
25
    public function sessionClear()
26
    {
27
        $this->session = [];
28
    }
29
30
    /**
31
     * @return mixed
32
     */
33
    public function sessionGet($key, $fallback = '')
34
    {
35
        $value = Arr::get($this->session, $key, $fallback);
36
        unset($this->session[$key]);
37
        return $value;
38
    }
39
40
    /**
41
     * @return void
42
     */
43
    public function sessionSet($key, $value)
44
    {
45
        $this->session[$key] = $value;
46
    }
47
}
48