HistogramCollector::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Krenor\Prometheus\Storage\Bindings\Collectors;
4
5
use Krenor\Prometheus\Contracts\Binding;
6
use Krenor\Prometheus\Metrics\Histogram;
7
use Tightenco\Collect\Support\Collection;
8
use Krenor\Prometheus\Storage\Builders\HistogramSamplesBuilder;
9
10
class HistogramCollector extends Binding
11
{
12
    /**
13
     * @param Histogram $histogram
14
     * @param Collection $items
15
     *
16
     * @return HistogramSamplesBuilder
17
     */
18 6
    public function __invoke(Histogram $histogram, Collection $items): HistogramSamplesBuilder
19
    {
20 6
        return new HistogramSamplesBuilder($histogram, $items->merge(
21 6
            $this->repository->get("{$this->key}:SUM")
22
        ));
23
    }
24
}
25