Completed
Push — develop ( 3605f5...4a88bc )
by Stan
04:14
created

InMemoryRepository::retrieve()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Krenor\Prometheus\Storage\Repositories;
4
5
use Tightenco\Collect\Support\Collection;
6
7
class InMemoryRepository extends SimpleRepository
8
{
9
    /**
10
     * @var Collection
11
     */
12
    protected $items;
13
14
    /**
15
     * InMemoryRepository constructor.
16
     */
17
    public function __construct()
18
    {
19
        $this->items = new Collection;
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function flush(): bool
26
    {
27
        $this->items = new Collection;
28
29
        return true;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected function retrieve(string $key)
36
    {
37
        return $this->items->get($key);
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    protected function store(string $key, Collection $collection): bool
44
    {
45
        $this->items->put($key, $collection);
46
47
        return false;
48
    }
49
}
50