NullCache::getMultiple()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Vectorface\Cache;
4
5
use DateInterval;
6
7
/**
8
 * A cache that caches nothing and always fails.
9
 */
10
class NullCache implements Cache, AtomicCounter
11
{
12
    /**
13 3
     * @inheritDoc
14
     */
15 3
    public function get(string $key, mixed $default = null) : mixed
16
    {
17
        return $default;
18
    }
19
20
    /**
21 4
     * @inheritDoc
22
     */
23 4
    public function set(string $key, mixed $value, DateInterval|int|null $ttl = null) : bool
24
    {
25
        return false;
26
    }
27
28
    /**
29 3
     * @inheritDoc
30
     */
31 3
    public function delete(string $key) : bool
32
    {
33
        return false;
34
    }
35
36
    /**
37 3
     * @inheritDoc
38
     */
39 3
    public function clean() : bool
40
    {
41
        return false;
42
    }
43
44
    /**
45 3
     * @inheritDoc
46
     */
47 3
    public function flush() : bool
48
    {
49
        return false;
50
    }
51
52
    /**
53 1
     * @inheritDoc
54
     */
55 1
    public function clear() : bool
56
    {
57
        return false;
58
    }
59
60
    /**
61 2
     * @inheritDoc
62
     */
63 2
    public function getMultiple(iterable $keys, mixed $default = null) : iterable
64 2
    {
65 2
        $defaults = [];
66
        foreach ($keys as $key) {
67 2
            $defaults[$key] = $default;
68
        }
69
        return $defaults;
70
    }
71
72
    /**
73 2
     * @inheritDoc
74
     */
75 2
    public function setMultiple(iterable $values, DateInterval|int|null $ttl = null) : bool
76
    {
77
        return false;
78
    }
79
80
    /**
81 2
     * @inheritDoc
82
     */
83 2
    public function deleteMultiple(iterable $keys) : bool
84
    {
85
        return false;
86
    }
87
88
    /**
89 1
     * @inheritDoc
90
     */
91 1
    public function has(string $key) : bool
92
    {
93
        return false;
94
    }
95
96
    /**
97 2
     * @inheritDoc
98
     */
99 2
    public function increment(string $key, int $step = 1, DateInterval|int|null $ttl = null) : int|false
100
    {
101
        return false;
102
    }
103
104
    /**
105 2
     * @inheritDoc
106
     */
107 2
    public function decrement(string $key, int $step = 1, DateInterval|int|null $ttl = null) : int|false
108
    {
109
        return false;
110
    }
111
}
112