Completed
Push — master ( de1e0b...7a42c8 )
by Patryk
03:54 queued 53s
created

DoctrineCacheBridge::deleteAll()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
3
namespace KaLLoSz\Twig\Extension\Cache;
4
5
use Doctrine\Common\Cache\Cache;
6
7
/**
8
 * Class DoctrineCacheBridge
9
 */
10
class DoctrineCacheBridge implements CacheInterface
11
{
12
    /**
13
     * @var Cache
14
     */
15
    private $cache;
16
17
    /**
18
     * @param Cache $cache
19
     */
20 20
    public function __construct(Cache $cache)
21
    {
22 20
        $this->cache = $cache;
23 20
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 4
    public function get($id)
29
    {
30 4
        return $this->has($id) ? $this->cache->fetch($id) : false;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 12
    public function has($id)
37
    {
38 12
        return $this->cache->contains($id);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 12
    public function save($id, $data, $lifeTime = 0)
45
    {
46 12
        return $this->cache->save($id, $data, $lifeTime);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 4
    public function delete($id)
53
    {
54 4
        return $this->cache->delete($id);
55
    }
56
}
57