CountAggregator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toArray() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Aggregations;
5
6
class CountAggregator implements AggregatorInterface
7
{
8
    protected string $outputName;
9
10
    /**
11
     * CountAggregator constructor.
12
     *
13
     * @param string $outputName
14
     */
15 1
    public function __construct(string $outputName)
16
    {
17 1
        $this->outputName = $outputName;
18
    }
19
20
    /**
21
     * Return the aggregator as it can be used in a druid query.
22
     *
23
     * @return array<string,string>
24
     */
25 1
    public function toArray(): array
26
    {
27 1
        return [
28 1
            'type' => 'count',
29 1
            'name' => $this->outputName,
30 1
        ];
31
    }
32
}