CacheAwareTrait::setCacheKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace Phact\Router;
4
5
use DateInterval;
6
use Psr\SimpleCache\CacheInterface;
7
8
trait CacheAwareTrait
9
{
10
    /** @var CacheInterface */
11
    protected $cache;
12
13
    /** @var string */
14
    protected $cacheKey = 'routes';
15
16
    /** @var null|int|DateInterval */
17
    protected $cacheTTL;
18
19
    /**
20
     * @inheritDoc
21
     */
22 4
    public function setCache(CacheInterface $cache): void
23
    {
24 4
        $this->cache = $cache;
25 4
    }
26
27
    /**
28
     * @inheritDoc
29
     */
30 1
    public function setCacheKey(string $key = 'routes'): void
31
    {
32 1
        $this->cacheKey = $key;
33 1
    }
34
35
    /**
36
     * @inheritDoc
37
     */
38 1
    public function setCacheTTL($ttl = 60): void
39
    {
40 1
        $this->cacheTTL = $ttl;
41 1
    }
42
}
43