Passed
Push — feature/change-cache-to-profil... ( 160b60 )
by Chema
04:07
created

ProfiledInMemoryCache::getAll()   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 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
ccs 0
cts 2
cp 0
cc 1
nc 1
nop 0
crap 2
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 $decoradedCache;
10
    private FileProfilerInterface $fileProfiler;
11
12 4
    public function __construct(
13
        ClassNameCacheInterface $decoratedCache,
14
        FileProfilerInterface $fileProfiler
15
    ) {
16 4
        $this->decoradedCache = $decoratedCache;
17 4
        $this->fileProfiler = $fileProfiler;
18
    }
19
20 4
    public function has(string $cacheKey): bool
21
    {
22 4
        return $this->decoradedCache->has($cacheKey);
23
    }
24
25 3
    public function get(string $cacheKey): string
26
    {
27 3
        return $this->decoradedCache->get($cacheKey);
28
    }
29
30
    public function getAll(): array
31
    {
32
        return $this->decoradedCache->getAll();
33
    }
34
35 2
    public function put(string $cacheKey, string $className): void
36
    {
37 2
        $this->decoradedCache->put($cacheKey, $className);
38 2
        $this->fileProfiler->updateFileCache($this->decoradedCache->getAll());
39
    }
40
}
41