Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
27 | 4 | public function get($key){ |
|
28 | 4 | $file = "{$this->cacheDir}/{$key}.json"; |
|
29 | 4 | $cache = null; |
|
30 | 4 | if(file_exists($file)){ |
|
31 | 4 | $cache = json_decode(file_get_contents($file)); |
|
32 | 4 | if($cache->expires_at < time()){ |
|
33 | 1 | $cache = null; |
|
34 | 1 | $this->clear($key); |
|
35 | } |
||
36 | } |
||
37 | 4 | return $cache; |
|
38 | } |
||
46 | } |