Passed
Push — master ( a53d55...43aca1 )
by Maximilian
03:50
created

DropShadow   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
dl 0
loc 40
ccs 13
cts 13
cp 1
rs 10
c 1
b 0
f 1
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A jsonSerialize() 0 21 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\AVGFilter;
6
7
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\AVGFilterType;
8
9
class DropShadow extends AVGFilter implements \JsonSerializable
10
{
11
    public const TYPE = AVGFilterType::DROP_SHADOW;
12
13
    /**
14
     * @param string|null $color Color of the drop shadow
15
     * @param int|null $horizontalOffset Horizontal offset of the shadow
16
     * @param int|null $radius Blur radius of the shadow
17
     * @param int|null $verticalOffset Vertical offset of the shadow
18
     */
19 12
    public function __construct(
20
        public ?string $color = null,
21
        public ?int $horizontalOffset = null,
22
        public ?int $radius = null,
23
        public ?int $verticalOffset = null,
24
    ) {
25 12
        parent::__construct(self::TYPE);
26
    }
27
28 8
    public function jsonSerialize(): array
29
    {
30 8
        $data = parent::jsonSerialize();
31
32 8
        if ($this->color !== null) {
33 6
            $data['color'] = $this->color;
34
        }
35
36 8
        if ($this->horizontalOffset !== null) {
37 4
            $data['horizontalOffset'] = $this->horizontalOffset;
38
        }
39
40 8
        if ($this->radius !== null) {
41 5
            $data['radius'] = $this->radius;
42
        }
43
44 8
        if ($this->verticalOffset !== null) {
45 4
            $data['verticalOffset'] = $this->verticalOffset;
46
        }
47
48 8
        return $data;
49
    }
50
}
51