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

InMemoryRepository::push()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

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