TransformCollection::getType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Collections;
5
6
use Level23\Druid\Transforms\TransformInterface;
7
8
/**
9
 * @extends \Level23\Druid\Collections\BaseCollection<TransformInterface>
10
 */
11
class TransformCollection extends BaseCollection
12
{
13
    /**
14
     * DimensionCollection constructor.
15
     *
16
     * @param \Level23\Druid\Transforms\TransformInterface ...$transforms
17
     */
18 6
    public function __construct(TransformInterface ...$transforms)
19
    {
20 6
        $this->items = array_values($transforms);
21
    }
22
23
    /**
24
     * We only accept objects of this type.
25
     *
26
     * @return string
27
     */
28 1
    public function getType(): string
29
    {
30 1
        return TransformInterface::class;
31
    }
32
33
    /**
34
     * Return an array representation of our items
35
     *
36
     * @return array<int,array<mixed>>
37
     */
38 4
    public function toArray(): array
39
    {
40 4
        return array_map(fn(TransformInterface $item) => $item->toArray(), $this->items);
41
    }
42
}