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

Settings::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 0
nc 1
nop 3
dl 0
loc 5
ccs 1
cts 1
cp 1
crap 1
rs 10
c 1
b 0
f 1
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