CacheAdapter::retrieve()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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