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

S3InputSource::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
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
}