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

SpatialDimension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 5 1
A __construct() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Dimensions;
5
6
class SpatialDimension
7
{
8
    protected string $dimension;
9
10
    /**
11
     * @var string[]
12
     */
13
    protected array $dims;
14
15
    /**
16
     * @param string   $dimension The name of the spatial dimension. A spatial dimension may be constructed from
17
     *                            multiple other dimensions or it may already exist as part of an event. If a spatial
18
     *                            dimension already exists, it must be an array of coordinate values.
19
     * @param string[] $dims      A list of dimension names that comprise a spatial dimension.
20
     */
21 3
    public function __construct(string $dimension, array $dims)
22
    {
23
24 3
        $this->dimension = $dimension;
25 3
        $this->dims      = $dims;
26
    }
27
28
    /**
29
     * @return array<string,string|string[]>
30
     */
31 2
    public function toArray(): array
32
    {
33
        return [
34 2
            'dimName' => $this->dimension,
35 2
            'dims'    => $this->dims,
36
        ];
37
    }
38
}
39