NullStore::sort()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
nc 1
cc 1
eloc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the webmozart/key-value-store package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
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 Webmozart\KeyValueStore;
13
14
use Webmozart\KeyValueStore\Api\CountableStore;
15
use Webmozart\KeyValueStore\Api\NoSuchKeyException;
16
use Webmozart\KeyValueStore\Api\SortableStore;
17
18
/**
19
 * A key-value store that does nothing.
20
 *
21
 * @since  1.0
22
 *
23
 * @author Bernhard Schussek <[email protected]>
24
 */
25
class NullStore implements SortableStore, CountableStore
26
{
27
    /**
28
     * {@inheritdoc}
29
     */
30 9
    public function set($key, $value)
31
    {
32 9
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 1
    public function get($key, $default = null)
38
    {
39 1
        return $default;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45 1
    public function getOrFail($key)
46
    {
47 1
        throw NoSuchKeyException::forKey($key);
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53 1
    public function getMultiple(array $keys, $default = null)
54
    {
55 1
        return array_fill_keys($keys, $default);
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61 1
    public function getMultipleOrFail(array $keys)
62
    {
63 1
        throw NoSuchKeyException::forKeys($keys);
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69 1
    public function remove($key)
70
    {
71 1
        return false;
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77 1
    public function exists($key)
78
    {
79 1
        return false;
80
    }
81
82
    /**
83
     * {@inheritdoc}
84
     */
85 1
    public function clear()
86
    {
87 1
    }
88
89
    /**
90
     * {@inheritdoc}
91
     */
92 3
    public function keys()
93
    {
94 3
        return array();
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100 1
    public function sort($flags = SORT_REGULAR)
101
    {
102 1
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107
    public function count()
108
    {
109
        return 0;
110
    }
111
}
112