SessionStorage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 6 1
A get() 0 4 1
A forget() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of ibrand/laravel-shopping-cart.
5
 *
6
 * (c) iBrand <https://www.ibrand.cc>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace iBrand\Shoppingcart\Storage;
13
14
/**
15
 * Class SessionStorage.
16
 */
17
class SessionStorage implements Storage
18
{
19
    /**
20
     * @param $key
21
     * @param $value
22
     */
23
    public function set($key, $value)
24
    {
25
        session([
26
            $key => $value,
27
        ]);
28
    }
29
30
    /**
31
     * @param $key
32
     * @param null $default
33
     *
34
     * @return \Illuminate\Session\SessionManager|\Illuminate\Session\Store|mixed
35
     */
36
    public function get($key, $default = null)
37
    {
38
        return session($key, $default);
39
    }
40
41
    /**
42
     * @param $key
43
     */
44
    public function forget($key)
45
    {
46
        session()->forget($key);
47
    }
48
}
49