Passed
Pull Request — master (#97)
by Maximilian
04:17
created

Settings   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
dl 0
loc 24
ccs 11
cts 11
cp 1
rs 10
c 1
b 0
f 1
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A jsonSerialize() 0 15 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Document;
6
7
class Settings implements \JsonSerializable
8
{
9 15
    public function __construct(
10
        public int|float|null $idleTimeout = null,
11
        public ?PseudoLocalization $pseudoLocalization = null,
12
        public bool $supportsResizing = false,
13
    ) {
14 15
    }
15
16 10
    public function jsonSerialize(): array
17
    {
18 10
        $data = [];
19
20 10
        if ($this->idleTimeout !== null) {
21 6
            $data['idleTimeout'] = $this->idleTimeout;
22
        }
23 10
        if ($this->pseudoLocalization !== null) {
24 3
            $data['pseudoLocalization'] = $this->pseudoLocalization;
25
        }
26 10
        if ($this->supportsResizing) {
27 4
            $data['supportsResizing'] = $this->supportsResizing;
28
        }
29
30 10
        return $data;
31
    }
32
}
33