SessionStorage::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Infinitypaul\MultiStep\Store;
4
5
use Illuminate\Http\Request;
6
use Infinitypaul\MultiStep\Store\Contracts\StepStorage;
7
8
/**
9
 * @method string completed()
10
 * @method string data()
11
 */
12
class SessionStorage implements StepStorage
13
{
14
    protected $request;
15
16
    /**
17
     * MultiStepSystem constructor.
18
     *
19
     * @param \Illuminate\Http\Request $request
20
     */
21
    public function __construct(Request $request)
0 ignored issues
show
Bug introduced by
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
22
    {
23
        $this->request = $request;
24
    }
25
26
    /**
27
     * @param $key
28
     * @param $value
29
     */
30
    public function put($key, $value)
31
    {
32
        return $this->request->session()->put($key, $value);
33
    }
34
35
    public function get($key)
36
    {
37
        return $this->request->session()->get($key);
38
    }
39
40
    public function forget($key)
41
    {
42
        return $this->request->session()->forget($key);
43
    }
44
}
45