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

SpatialDimension::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\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