NullDriver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 41
ccs 5
cts 5
cp 1
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A erase() 0 3 1
A get() 0 3 1
A set() 0 3 1
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