Completed
Branch ci (96427e)
by Дмитрий
01:33
created

AnnotationCache::contains()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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