IlluminateSessionStorage::set()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Happyr\LinkedIn\Storage;
4
5
use Illuminate\Support\Facades\Session;
6
7
/**
8
 * Store data in a IlluminateSession.
9
 *
10
 * @author Andreas Creten
11
 */
12
class IlluminateSessionStorage extends BaseDataStorage
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 2
    public function set($key, $value)
18
    {
19 2
        $this->validateKey($key);
20 1
        $name = $this->getStorageKeyId($key);
21
22 1
        return Session::put($name, $value);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 1
    public function get($key)
29
    {
30 1
        $this->validateKey($key);
31 1
        $name = $this->getStorageKeyId($key);
32
33 1
        return Session::get($name);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 2
    public function clear($key)
40
    {
41 2
        $this->validateKey($key);
42 1
        $name = $this->getStorageKeyId($key);
43
44 1
        return Session::forget($name);
45
    }
46
}
47