Completed
Push — master ( 8a5d17...e6ebc2 )
by personal
03:22
created

CacheMemory::has()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * (c) Jean-François Lépine <https://twitter.com/Halleck45>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Hal\Component\Cache;
11
use Hal\Component\Result\ResultCollection;
12
13
/**
14
 * Cache
15
 *
16
 * @author Jean-François Lépine <https://twitter.com/Halleck45>
17
 */
18
class CacheMemory implements Cache {
19
20
    /**
21
     * @var array
22
     */
23
    private $data = array();
24
25
    /**
26
     * @inheritdoc
27
     */
28
    public function set($key, $value) {
29
        $this->data[$key] = $value;
30
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function get($key) {
36
        return $this->data[$key];
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42
    public function has($key) {
43
        return isset($this->data[$key]);
44
    }
45
46
    /**
47
     * @inheritdoc
48
     */
49
    public function clear($key) {
50
        $this->data = array();
51
    }
52
}