|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
6
|
|
|
|
|
7
|
|
|
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\ScrollAlign; |
|
8
|
|
|
|
|
9
|
|
|
class SpeakListCommand extends AbstractStandardCommand implements \JsonSerializable |
|
10
|
|
|
{ |
|
11
|
|
|
public const TYPE = 'SpeakList'; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @param string|null $componentId ID of the component to speak |
|
15
|
|
|
* @param ScrollAlign $align Alignment when scrolling to items |
|
16
|
|
|
* @param int|null $count Number of items to speak |
|
17
|
|
|
* @param int|null $minimumDwellTime Minimum time to dwell on each item in milliseconds |
|
18
|
|
|
* @param int|null $start Starting index for speaking |
|
19
|
|
|
*/ |
|
20
|
8 |
|
public function __construct( |
|
21
|
|
|
public ?string $componentId = null, |
|
22
|
|
|
public ScrollAlign $align = ScrollAlign::VISIBLE, |
|
23
|
|
|
public ?int $count = null, |
|
24
|
|
|
public ?int $minimumDwellTime = null, |
|
25
|
|
|
public ?int $start = null, |
|
26
|
|
|
) { |
|
27
|
8 |
|
parent::__construct(self::TYPE); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
6 |
|
public function jsonSerialize(): array |
|
31
|
|
|
{ |
|
32
|
6 |
|
$data = parent::jsonSerialize(); |
|
33
|
|
|
|
|
34
|
6 |
|
if ($this->componentId !== null) { |
|
35
|
5 |
|
$data['componentId'] = $this->componentId; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
6 |
|
$data['align'] = $this->align->value; |
|
39
|
|
|
|
|
40
|
6 |
|
if ($this->count !== null) { |
|
41
|
3 |
|
$data['count'] = $this->count; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
6 |
|
if ($this->minimumDwellTime !== null) { |
|
45
|
2 |
|
$data['minimumDwellTime'] = $this->minimumDwellTime; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
6 |
|
if ($this->start !== null) { |
|
49
|
2 |
|
$data['start'] = $this->start; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
6 |
|
return $data; |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|