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

InMemoryRepository::set()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 2
nop 4
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 3
rs 9.4285
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