Passed
Push — master ( f6e659...bb9ac5 )
by Patrick
04:00
created

CacheFacade::has()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
ccs 0
cts 2
cp 0
crap 2
1
<?php
2
3
namespace ForecastAutomation\Cache;
4
5
use ForecastAutomation\Kernel\AbstractFacade;
6
use Shieldon\SimpleCache\Cache;
7
8
/**
9
 * @method \ForecastAutomation\Cache\CacheFactory getFactory()
10
 */
11
class CacheFacade extends AbstractFacade
12
{
13
    public function get($key, $default = null):mixed
14
    {
15
        //ToDo: Move str_replace to Business + add cache disable option means has = always false
16
        return $this->getFactory()->createSimpleCache()->get(\str_replace('/','',$key), $default);
17
    }
18
    public function has($key):bool
19
    {
20
        return $this->getFactory()->createSimpleCache()->has(\str_replace('/','',$key));
21
    }
22
    public function set($key, $value, $ttl = 600):bool
23
    {
24
        return $this->getFactory()->createSimpleCache()->set(\str_replace('/','',$key), $value, $ttl);
25
    }
26
}
27