Passed
Push — master ( 51a94b...0f3d7a )
by Jesús
01:31 queued 13s
created

ProfiledCache::put()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
rs 10
ccs 3
cts 3
cp 1
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Framework\ClassResolver\Cache;
6
7
use Gacela\Framework\ClassResolver\Profiler\FileProfilerInterface;
8
9
final class ProfiledCache implements CacheInterface
10
{
11
    private CacheInterface $decoratedCache;
12
    private FileProfilerInterface $fileProfiler;
13
14 1
    public function __construct(
15
        CacheInterface $decoratedCache,
16
        FileProfilerInterface $fileProfiler
17
    ) {
18 1
        $this->decoratedCache = $decoratedCache;
19 1
        $this->fileProfiler = $fileProfiler;
20
    }
21
22 1
    public function has(string $cacheKey): bool
23
    {
24 1
        return $this->decoratedCache->has($cacheKey);
25
    }
26
27 1
    public function get(string $cacheKey): string
28
    {
29 1
        return $this->decoratedCache->get($cacheKey);
30
    }
31
32
    public function getAll(): array
33
    {
34
        return $this->decoratedCache->getAll();
35
    }
36
37 1
    public function put(string $cacheKey, string $className): void
38
    {
39 1
        $this->decoratedCache->put($cacheKey, $className);
40
41 1
        $this->fileProfiler->updateProfiler($this->decoratedCache->getAll());
42
    }
43
}
44