SummaryObserver   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 1
1
<?php
2
3
namespace Krenor\Prometheus\Storage\Bindings\Observers;
4
5
use Krenor\Prometheus\Metrics\Summary;
6
use Krenor\Prometheus\Contracts\Binding;
7
use Tightenco\Collect\Support\Collection;
8
9
class SummaryObserver extends Binding
10
{
11
    /**
12
     * @param Summary $summary
13
     * @param Collection $labels
14
     * @param float $value
15
     *
16
     * @return void
17
     */
18 6
    public function __invoke(Summary $summary, Collection $labels, float $value): void
19
    {
20 6
        $identifier = "{$this->key}:" . crc32($labels->toJson()) . ':VALUES';
21
22 6
        $this->repository->set($this->key, $labels->toJson(), $identifier);
23 6
        $this->repository->push($identifier, $value);
24 6
    }
25
}
26