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

S3InputSource   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 9
c 0
b 0
f 0
dl 0
loc 39
ccs 10
cts 10
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toArray() 0 9 2
A getCloudType() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\InputSources;
5
6
class S3InputSource extends CloudInputSource
7
{
8
    /**
9
     * @var array<string,string>
10
     */
11
    protected array $properties;
12
13
    /**
14
     * S3InputSource constructor.
15
     *
16
     * @param string[]                    $uris
17
     * @param string[]                    $prefixes
18
     * @param array<array<string,string>> $objects
19
     * @param array<string,string>        $properties
20
     */
21 5
    public function __construct(array $uris = [], array $prefixes = [], array $objects = [], array $properties = [])
22
    {
23 5
        parent::__construct($uris, $prefixes, $objects);
24
25 4
        $this->properties = $properties;
26
    }
27
28
    /**
29
     * @return array<string,string|string[]|array<array<string,string>>>
30
     */
31 4
    public function toArray(): array
32
    {
33 4
        $response = parent::toArray();
34
35 4
        if (count($this->properties) > 0) {
36 1
            $response['properties'] = $this->properties;
37
        }
38
39 4
        return $response;
40
    }
41
42 4
    protected function getCloudType(): string
43
    {
44 4
        return 's3';
45
    }
46
}