Passed
Push — master ( 8f94e1...adfcdc )
by Chema
01:29 queued 13s
created

ProfiledInMemoryCache::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 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
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;
6
7
final class ProfiledInMemoryCache implements ClassNameCacheInterface
8
{
9
    private ClassNameCacheInterface $decoratedCache;
10
    private FileProfilerInterface $fileProfiler;
11
12 4
    public function __construct(
13
        ClassNameCacheInterface $decoratedCache,
14
        FileProfilerInterface $fileProfiler
15
    ) {
16 4
        $this->decoratedCache = $decoratedCache;
17 4
        $this->fileProfiler = $fileProfiler;
18
    }
19
20 4
    public function has(string $cacheKey): bool
21
    {
22 4
        return $this->decoratedCache->has($cacheKey);
23
    }
24
25 3
    public function get(string $cacheKey): string
26
    {
27 3
        return $this->decoratedCache->get($cacheKey);
28
    }
29
30
    public function getAll(): array
31
    {
32
        return $this->decoratedCache->getAll();
33
    }
34
35 2
    public function put(string $cacheKey, string $className): void
36
    {
37 2
        $this->decoratedCache->put($cacheKey, $className);
38
39 2
        $this->fileProfiler->updateProfiler($this->decoratedCache->getAll());
40
    }
41
}
42