ReflectionCacheArray   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fetch() 0 8 3
A store() 0 4 1
1
<?php
2
3
namespace Atreyu;
4
5
class ReflectionCacheArray implements ReflectionCache
6
{
7
    private $cache = [];
8
9
    public function fetch($key)
10
    {
11
        // The additional isset() check here improves performance but we also
12
        // need array_key_exists() because some cached values === NULL.
13
        return (isset($this->cache[$key]) || array_key_exists($key, $this->cache))
14
            ? $this->cache[$key]
15
            : false;
16
    }
17
18
    public function store($key, $data)
19
    {
20
        $this->cache[$key] = $data;
21
    }
22
}
23