LayoutParameter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
dl 0
loc 26
ccs 12
cts 12
cp 1
rs 10
c 1
b 0
f 1
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A jsonSerialize() 0 16 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Document;
6
7
class LayoutParameter implements \JsonSerializable
8
{
9 14
    public function __construct(
10
        public string $name,
11
        public mixed $default = null,
12
        public ?string $description = null,
13
        public LayoutParameterType $type = LayoutParameterType::ANY,
14
    ) {
15 14
    }
16
17 10
    public function jsonSerialize(): array
18
    {
19 10
        $data = [
20 10
            'name' => $this->name,
21 10
            'type' => $this->type,
22 10
        ];
23
24 10
        if ($this->default !== null) {
25 7
            $data['default'] = $this->default;
26
        }
27
28 10
        if ($this->description !== null) {
29 3
            $data['description'] = $this->description;
30
        }
31
32 10
        return $data;
33
    }
34
}
35