Passed
Push — master ( 0c0438...de1b4b )
by Jean-Christophe
09:49
created

DAOMemoryCache::fetch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 2
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Ubiquity\cache\dao;
4
5
/**
6
 * Simple Memory cache for DAO instances
7
 * Ubiquity\cache\dao$DAOMemoryCache
8
 * This class is part of Ubiquity
9
 *
10
 * @author jc
11
 * @version 1.0.0
12
 *
13
 */
14
class DAOMemoryCache extends AbstractDAOCache {
15
	/**
16
	 *
17
	 * @var array
18
	 */
19
	protected $arrayCache;
20
21 1
	public function store($class, $key, $object) {
22 1
		$this->arrayCache [$class] [$key] = $object;
23 1
	}
24
25 1
	public function fetch($class, $key) {
26 1
		return $this->arrayCache [$class] [$key] ?? false;
27
	}
28
29
	public function delete($class, $key) {
30
		if (isset ( $this->arrayCache [$class] [$key] )) {
31
			unset ( $this->arrayCache [$class] [$key] );
32
		}
33
	}
34
}
35
36