AutoPageCommand   A
last analyzed

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\StandardCommand;
6
7
class AutoPageCommand extends AbstractStandardCommand
8
{
9
    public const TYPE = 'AutoPage';
10
11
    /**
12
     * @param string|null $componentId The ID of the component to auto-page
13
     * @param int|null $count Number of pages to advance
14
     * @param int|null $duration Duration of the auto-paging in milliseconds
15
     * @param int|null $transitionDuration Duration of each page transition in milliseconds
16
     */
17 5
    public function __construct(
18
        public ?string $componentId = null,
19
        public ?int $count = null,
20
        public ?int $duration = null,
21
        public ?int $transitionDuration = null,
22
    ) {
23 5
        parent::__construct(self::TYPE);
24
    }
25
26 3
    public function jsonSerialize(): array
27
    {
28 3
        $data = parent::jsonSerialize();
29
30 3
        if ($this->componentId !== null) {
31 2
            $data['componentId'] = $this->componentId;
32
        }
33
34 3
        if ($this->count !== null) {
35 2
            $data['count'] = $this->count;
36
        }
37
38 3
        if ($this->duration !== null) {
39 1
            $data['duration'] = $this->duration;
40
        }
41
42 3
        if ($this->transitionDuration !== null) {
43 1
            $data['transitionDuration'] = $this->transitionDuration;
44
        }
45
46 3
        return $data;
47
    }
48
}
49