ArbitraryGranularity::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Granularities;
5
6
class ArbitraryGranularity extends AbstractGranularity implements GranularityInterface
7
{
8
    /**
9
     * Return the granularity in array format so that we can use it in a druid request.
10
     *
11
     * @return array<string,string|string[]|bool>
12
     */
13 2
    public function toArray(): array
14
    {
15 2
        return [
16 2
            'type'             => 'arbitrary',
17 2
            'queryGranularity' => $this->queryGranularity->value,
18 2
            'rollup'           => $this->rollup,
19 2
            'intervals'        => $this->intervals->toArray(),
20 2
        ];
21
    }
22
}