Passed
Push — develop ( 8c6599...c9bdac )
by Stan
04:29
created

SummaryCollector::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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