Passed
Push — master ( d1927b...0cf6ab )
by Herberto
02:26
created

NullCache::fetch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Hgraca\Cache\Null;
4
5
use Hgraca\Cache\CacheInterface;
6
use Hgraca\Cache\Exception\CacheItemNotFoundException;
7
8
final class NullCache implements CacheInterface
9
{
10
11
    public function fetch(string $id)
12
    {
13
        throw new CacheItemNotFoundException();
14
    }
15
16
    public function contains(string $id): bool
17
    {
18
        return false;
19
    }
20
21
    public function save(string $id, $data, int $lifeTime = 0): bool
22
    {
23
        return false;
24
    }
25
26
    public function delete(string $id): bool
27
    {
28
        return true;
29
    }
30
31
    public function getStats(): array
32
    {
33
        return [
34
            static::STATS_HITS => 0,
35
            static::STATS_MISSES => 0,
36
            static::STATS_UPTIME => 0,
37
            static::STATS_MEMORY_USAGE => memory_get_usage(),
38
            static::STATS_MEMORY_AVAILABLE => ini_get('memory_limit') - memory_get_usage(),
39
            static::STATS_ITEM_COUNT => 0,
40
        ];
41
    }
42
}
43