Group   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 17
c 1
b 0
f 1
dl 0
loc 52
ccs 17
cts 17
cp 1
rs 10
wmc 8

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
B jsonSerialize() 0 29 7
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\AVGItem;
6
7
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\AVGItemType;
8
9
class Group extends AVGItem implements \JsonSerializable
10
{
11
    public const TYPE = AVGItemType::GROUP;
12
13
    /**
14
     * @param string|null $clipPath Clipping path for the group
15
     * @param array|null $data Array of data for inflation
16
     * @param AVGItem|null $item Single child item
17
     * @param AVGItem[]|null $items Array of child items
18
     * @param float|null $opacity Opacity of the group
19
     * @param string|null $transform Transform to apply to the group
20
     */
21 11
    public function __construct(
22
        public ?string $clipPath = null,
23
        public ?array $data = null,
24
        public ?AVGItem $item = null,
25
        public ?array $items = null,
26
        public ?float $opacity = null,
27
        public ?string $transform = null,
28
    ) {
29 11
        parent::__construct(self::TYPE);
30
    }
31
32 7
    public function jsonSerialize(): array
33
    {
34 7
        $data = parent::jsonSerialize();
35
36 7
        if ($this->clipPath !== null) {
37 3
            $data['clipPath'] = $this->clipPath;
38
        }
39
40 7
        if (!empty($this->data)) {
41 2
            $data['data'] = $this->data;
42
        }
43
44 7
        if ($this->item !== null) {
45 2
            $data['item'] = $this->item;
46
        }
47
48 7
        if (!empty($this->items)) {
49 2
            $data['items'] = $this->items;
50
        }
51
52 7
        if ($this->opacity !== null) {
53 4
            $data['opacity'] = $this->opacity;
54
        }
55
56 7
        if ($this->transform !== null) {
57 2
            $data['transform'] = $this->transform;
58
        }
59
60 7
        return $data;
61
    }
62
}
63