CacheAdapter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 33
rs 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A store() 0 3 1
A retrieve() 0 3 1
A __construct() 0 4 1
1
<?php
2
/**
3
 * File: CacheAdapter.php
4
 *
5
 * @author      Maciej Sławik <[email protected]>
6
 * Github:      https://github.com/maciejslawik
7
 */
8
9
namespace MSlwk\Otomoto\Middleware\Cache\Adapter;
10
11
use Stash\Interfaces\ItemInterface;
12
use Stash\Interfaces\PoolInterface;
13
14
/**
15
 * Class CacheAdapter
16
 * @package MSlwk\Otomoto\Middleware\Cache\Adapter
17
 */
18
class CacheAdapter implements CacheAdapterInterface
19
{
20
    /**
21
     * @var PoolInterface
22
     */
23
    private $pool;
24
25
    /**
26
     * FileAdapterInterface constructor.
27
     * @param PoolInterface $pool
28
     */
29 8
    public function __construct(
30
        PoolInterface $pool
31
    ) {
32 8
        $this->pool = $pool;
33 8
    }
34
35
    /**
36
     * @param ItemInterface $item
37
     * @return void
38
     */
39 4
    public function store(ItemInterface $item): void
40
    {
41 4
        $this->pool->save($item);
42 4
    }
43
44
    /**
45
     * @param string $path
46
     * @return ItemInterface
47
     */
48 4
    public function retrieve(string $path): ItemInterface
49
    {
50 4
        return $this->pool->getItem($path);
51
    }
52
}
53