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

HdfsInputSource::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\InputSources;
5
6
class HdfsInputSource implements InputSourceInterface
7
{
8
    /**
9
     * HDFS paths. Can be either a JSON array or comma-separated string of paths. Wildcards like * are supported in
10
     * these paths. Empty files located under one of the given paths will be skipped.
11
     *
12
     * @var string[]|string
13
     */
14
    protected $paths;
15
16
    /**
17
     * HdfsInputSource constructor.
18
     *
19
     * @param string[]|string $paths HDFS paths. Can be either a JSON array or comma-separated string of paths. Wildcards
20
     *                               like * are supported in these paths. Empty files located under one of the given paths
21
     *                               will be skipped.
22
     */
23 1
    public function __construct($paths)
24
    {
25 1
        $this->paths = $paths;
26
    }
27
28
    /**
29
     * @return array<string,string|string[]>
30
     */
31 1
    public function toArray(): array
32
    {
33
        return [
34 1
            'type'  => 'hdfs',
35 1
            'paths' => $this->paths,
36
        ];
37
    }
38
}