Passed
Push — master ( 3d8be6...81b9b0 )
by Sébastien
02:32
created

NullCache::delete()   A

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 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * NullCache convenience object taken from symfony/cache. Adapted for
7
 * PHP7.1 strict_types, original author Nicolas Grekas <[email protected]>.
8
 *
9
 * @see       https://github.com/soluble-io/soluble-mediatools for the canonical repository
10
 *
11
 * @copyright Copyright (c) 2018-2019 Sébastien Vanvelthem. (https://github.com/belgattitude)
12
 * @license   https://github.com/soluble-io/soluble-mediatools/blob/master/LICENSE.md MIT
13
 */
14
15
namespace Soluble\MediaTools\Common\Cache;
16
17
use Psr\SimpleCache\CacheInterface;
18
19
/**
20
 * NullCache convenience object taken from symfony/cache. Adapted for
21
 * PHP7.1 strict_types, original author Nicolas Grekas <[email protected]>.
22
 */
23
class NullCache implements CacheInterface
24
{
25
    /**
26
     * {@inheritdoc}
27
     *
28
     * @return mixed
29
     */
30 3
    public function get($key, $default = null)
31
    {
32 3
        return $default;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     *
38
     * @return mixed
39
     */
40 1
    public function getMultiple($keys, $default = null)
41
    {
42 1
        foreach ($keys as $key) {
43 1
            yield $key => $default;
44
        }
45 1
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50 1
    public function has($key): bool
51
    {
52 1
        return false;
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58 1
    public function clear(): bool
59
    {
60 1
        return true;
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66 1
    public function delete($key): bool
67
    {
68 1
        return true;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74 1
    public function deleteMultiple($keys): bool
75
    {
76 1
        return true;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82 1
    public function set($key, $value, $ttl = null): bool
83
    {
84 1
        return false;
85
    }
86
87
    /**
88
     * {@inheritdoc}
89
     */
90 1
    public function setMultiple($values, $ttl = null): bool
91
    {
92 1
        return false;
93
    }
94
}
95