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

Session   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 39
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A sessionClear() 0 3 1
A sessionSet() 0 3 1
A session() 0 3 1
A sessionGet() 0 5 1
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