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

InMemoryRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A flush() 0 5 1
A retrieve() 0 3 1
A store() 0 5 1
A __construct() 0 3 1
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