SummaryObserver::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
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