Style   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
B jsonSerialize() 0 21 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Document;
6
7
class Style implements \JsonSerializable
8
{
9
    /**
10
     * @param string|null $description Optional description of this style
11
     * @param string[]|null $extend List of styles that this style inherits from (array)
12
     * @param string|null $extends Single style that this style inherits from (string)
13
     * @param StyleValue|null $value Single style value object
14
     * @param StyleValue[]|null $values Array of style value objects
15
     */
16 16
    public function __construct(
17
        public ?string $description = null,
18
        public ?array $extend = null,
19
        public ?string $extends = null,
20
        public ?StyleValue $value = null,
21
        public ?array $values = null,
22
    ) {
23 16
    }
24
25 12
    public function jsonSerialize(): array
26
    {
27 12
        $data = [];
28
29 12
        if ($this->description !== null && $this->description !== '') {
30 2
            $data['description'] = $this->description;
31
        }
32 12
        if ($this->extend !== null && $this->extend !== []) {
33 3
            $data['extend'] = $this->extend;
34
        }
35 12
        if ($this->extends !== null && $this->extends !== '') {
36 2
            $data['extends'] = $this->extends;
37
        }
38 12
        if ($this->value instanceof StyleValue) {
39 3
            $data['value'] = $this->value;
40
        }
41 12
        if ($this->values !== null && $this->values !== []) {
42 2
            $data['values'] = $this->values;
43
        }
44
45 12
        return $data;
46
    }
47
}
48