CountAggregator::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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