NullDriver::set()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of slick/http
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 Slick\Http\Session\Driver;
13
14
use Slick\Http\Session\SessionDriverInterface;
15
16
/**
17
 * NullDriver
18
 *
19
 * @package Slick\Http\Session\Driver
20
*/
21
class NullDriver implements SessionDriverInterface
22
{
23
    /**
24
     * Returns the value store with provided key or the default value.
25
     *
26
     * @param string $key The key used to store the value in session.
27
     * @param string $default The default value if no value was stored.
28
     *
29
     * @return mixed The stored value or the default value if key
30
     *  was not found.
31
     */
32
    public function get($key, $default = null)
33 2
    {
34
        return $default;
35 2
    }
36
37
    /**
38
     * Set/Stores a provided values with a given key.
39
     *
40
     * @param string $key The key used to store the value in session.
41
     * @param mixed $value The value to store under the provided key.
42
     *
43
     * @return self|$this|SessionDriverInterface Self instance for
44
     *   method call chains.
45
     */
46
    public function set($key, $value)
47 2
    {
48
        return $this;
49 2
    }
50
51
    /**
52
     * Erases the values stored with the given key.
53
     *
54
     * @param string $key The key used to store the value in session.
55
     *
56
     * @return self|$this|SessionDriverInterface Self instance for
57
     *   method call chains.
58
     */
59
    public function erase($key)
60 2
    {
61
        return $this;
62 2
    }
63
}
64