DoctrineCache::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Onoi\Cache;
4
5
use Doctrine\Common\Cache\Cache as DoctrineCacheClient;
6
7
/**
8
 * Doctrine Cache decorator
9
 *
10
 * @license GNU GPL v2+
11
 * @since 1.0
12
 *
13
 * @author mwjames
14
 */
15
class DoctrineCache implements Cache {
16
17
	/**
18
	 * @var DoctrineCacheClient
19
	 */
20
	private $cache = null;
21
22
	/**
23
	 * @since 1.0
24
	 *
25
	 * @param DoctrineCacheClient $cache
26
	 */
27 9
	public function __construct( DoctrineCacheClient $cache ) {
28 9
		$this->cache = $cache;
29 9
	}
30
31
	/**
32
	 * @since  1.0
33
	 *
34
	 * {@inheritDoc}
35
	 */
36 2
	public function fetch( $id ) {
37 2
		return $this->cache->fetch( $id );
38
	}
39
40
	/**
41
	 * @since  1.0
42
	 *
43
	 * {@inheritDoc}
44
	 */
45 3
	public function contains( $id ) {
46 3
		return $this->cache->contains( $id );
47
	}
48
49
	/**
50
	 * @since  1.0
51
	 *
52
	 * {@inheritDoc}
53
	 */
54 3
	public function save( $id, $data, $ttl = 0 ) {
55 3
		$this->cache->save( $id, $data, $ttl );
56 3
	}
57
58
	/**
59
	 * @since  1.0
60
	 *
61
	 * {@inheritDoc}
62
	 */
63 3
	public function delete( $id ) {
64 3
		return $this->cache->delete( $id );
65
	}
66
67
	/**
68
	 * @since  1.0
69
	 *
70
	 * {@inheritDoc}
71
	 */
72 1
	public function getStats() {
73 1
		return $this->cache->getStats();
74
	}
75
76
	/**
77
	 * @since  1.2
78
	 *
79
	 * {@inheritDoc}
80
	 */
81 1
	public function getName() {
82 1
		return __CLASS__ . '::' . get_class( $this->cache );
83
	}
84
85
}
86