SimpleInMemoryCache::has()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
namespace SimpleCache\Cache;
4
5
/**
6
 * Very simple in memory cache. Entries are kept around until the object gets destructed.
7
 *
8
 * @licence GNU GPL v2+
9
 * @author Jeroen De Dauw < [email protected] >
10
 */
11
class SimpleInMemoryCache implements Cache {
12
13
	protected $memoryCache = array();
14
15 11
	public function get( $key ) {
16 11
		return array_key_exists( $key, $this->memoryCache ) ? $this->memoryCache[$key] : null;
17
	}
18
19 11
	public function has( $key ) {
20 11
		return array_key_exists( $key, $this->memoryCache );
21
	}
22
23 11
	public function set( $key, $value ) {
24 11
		$this->memoryCache[$key] = $value;
25 11
	}
26
27
}
28