AnnotationCache   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 54
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 3 1
A contains() 0 3 1
A getStats() 0 3 1
A fetch() 0 3 1
A __construct() 0 3 1
A save() 0 3 1
1
<?php
2
3
namespace yii\annotations;
4
5
use yii\caching\CacheInterface;
6
7
/**
8
 * Class AnnotationCache
9
 * @package yii\annotations
10
 */
11
class AnnotationCache implements AnnotationCacheInterface
12
{
13
    /**
14
     * @var CacheInterface
15
     */
16
    private $yiiCache;
17
18
    /**
19
     * AnnotationCache constructor.
20
     * @param CacheInterface $yiiCache
21
     */
22 17
    public function __construct(CacheInterface $yiiCache)
23
    {
24 17
        $this->yiiCache = $yiiCache;
25 17
    }
26
27
    /**
28
     * {@inheritDoc}
29
     */
30 10
    public function fetch($id)
31
    {
32 10
        return $this->yiiCache->get($id);
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38 3
    public function contains($id): bool
39
    {
40 3
        return $this->yiiCache->exists($id);
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46 9
    public function save($id, $data, $lifeTime = 0): bool
47
    {
48 9
        return $this->yiiCache->set($id, $data, $lifeTime);
49
    }
50
51
    /**
52
     * {@inheritDoc}
53
     */
54 1
    public function delete($id): bool
55
    {
56 1
        return $this->yiiCache->delete($id);
57
    }
58
59
    /**
60
     * {@inheritDoc}
61
     */
62 1
    public function getStats(): ?array
63
    {
64 1
        return null;
65
    }
66
}
67