Passed
Pull Request — master (#38)
by Teye
06:17
created

LookupDataSource   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

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\DataSources;
5
6
class LookupDataSource implements DataSourceInterface
7
{
8
    protected string $lookupName;
9
10 3
    public function __construct(string $lookupName)
11
    {
12 3
        $this->lookupName = $lookupName;
13
    }
14
15
    /**
16
     * Return the LookupDataSource so that it can be used in a druid query.
17
     *
18
     * @return array<string,string>
19
     */
20 1
    public function toArray(): array
21
    {
22
        return [
23 1
            'type' => 'lookup',
24 1
            'name' => $this->lookupName,
25
        ];
26
    }
27
}