Passed
Pull Request — master (#38)
by Teye
05:43
created

UnionDataSource::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\DataSources;
5
6
class UnionDataSource implements DataSourceInterface
7
{
8
    /**
9
     * @var string[]
10
     */
11
    protected array $tableNames;
12
13
    /**
14
     * @param string[] $tableNames
15
     */
16 4
    public function __construct(array $tableNames)
17
    {
18 4
        $this->tableNames = $tableNames;
19
    }
20
21
    /**
22
     * Return the LookupDataSource so that it can be used in a druid query.
23
     *
24
     * @return array<string,string|string[]>
25
     */
26 2
    public function toArray(): array
27
    {
28
        return [
29 2
            'type'        => 'union',
30 2
            'dataSources' => $this->tableNames,
31
        ];
32
    }
33
}