@@ -1,41 +1,41 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | + declare(strict_types=1); |
|
4 | 4 | |
5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
6 | 6 | |
7 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
8 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
8 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
9 | 9 | |
10 | -class DoublePress extends AbstractGesture |
|
11 | -{ |
|
12 | - /** |
|
10 | + class DoublePress extends AbstractGesture |
|
11 | + { |
|
12 | + /** |
|
13 | 13 | * @param AbstractStandardCommand[]|null $onDoublePress Commands to run on double press |
14 | 14 | * @param AbstractStandardCommand[]|null $onSinglePress Commands to run on single press |
15 | 15 | * @param AbstractStandardCommand[]|null $onCancel Commands to run when gesture is cancelled |
16 | 16 | * @param bool|null $when APL boolean expression controlling whether this gesture is active |
17 | 17 | */ |
18 | - public function __construct( |
|
19 | - public ?array $onDoublePress = null, |
|
20 | - public ?array $onSinglePress = null, |
|
21 | - ?array $onCancel = null, |
|
22 | - ?bool $when = null, |
|
23 | - ) { |
|
24 | - parent::__construct(GestureType::DOUBLE_PRESS, $onCancel, $when); |
|
25 | - } |
|
26 | - |
|
27 | - public function jsonSerialize(): array |
|
28 | - { |
|
29 | - $data = parent::jsonSerialize(); |
|
30 | - |
|
31 | - if ($this->onDoublePress !== null && !empty($this->onDoublePress)) { |
|
32 | - $data['onDoublePress'] = $this->onDoublePress; |
|
18 | + public function __construct( |
|
19 | + public ?array $onDoublePress = null, |
|
20 | + public ?array $onSinglePress = null, |
|
21 | + ?array $onCancel = null, |
|
22 | + ?bool $when = null, |
|
23 | + ) { |
|
24 | + parent::__construct(GestureType::DOUBLE_PRESS, $onCancel, $when); |
|
33 | 25 | } |
34 | 26 | |
35 | - if ($this->onSinglePress !== null && !empty($this->onSinglePress)) { |
|
36 | - $data['onSinglePress'] = $this->onSinglePress; |
|
37 | - } |
|
27 | + public function jsonSerialize(): array |
|
28 | + { |
|
29 | + $data = parent::jsonSerialize(); |
|
38 | 30 | |
39 | - return $data; |
|
40 | - } |
|
31 | + if ($this->onDoublePress !== null && !empty($this->onDoublePress)) { |
|
32 | + $data['onDoublePress'] = $this->onDoublePress; |
|
33 | + } |
|
34 | + |
|
35 | + if ($this->onSinglePress !== null && !empty($this->onSinglePress)) { |
|
36 | + $data['onSinglePress'] = $this->onSinglePress; |
|
37 | + } |
|
38 | + |
|
39 | + return $data; |
|
40 | + } |
|
41 | 41 | } |
@@ -7,8 +7,7 @@ |
||
7 | 7 | use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
8 | 8 | use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
9 | 9 | |
10 | -class DoublePress extends AbstractGesture |
|
11 | -{ |
|
10 | +class DoublePress extends AbstractGesture { |
|
12 | 11 | /** |
13 | 12 | * @param AbstractStandardCommand[]|null $onDoublePress Commands to run on double press |
14 | 13 | * @param AbstractStandardCommand[]|null $onSinglePress Commands to run on single press |
@@ -1,41 +1,41 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | + declare(strict_types=1); |
|
4 | 4 | |
5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
6 | 6 | |
7 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
8 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
8 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
9 | 9 | |
10 | -class LongPress extends AbstractGesture |
|
11 | -{ |
|
12 | - /** |
|
10 | + class LongPress extends AbstractGesture |
|
11 | + { |
|
12 | + /** |
|
13 | 13 | * @param AbstractStandardCommand[]|null $onLongPressStart Commands to run when long press starts |
14 | 14 | * @param AbstractStandardCommand[]|null $onLongPressEnd Commands to run when long press ends |
15 | 15 | * @param AbstractStandardCommand[]|null $onCancel Commands to run when gesture is cancelled |
16 | 16 | * @param bool|null $when APL boolean expression controlling whether this gesture is active |
17 | 17 | */ |
18 | - public function __construct( |
|
19 | - public ?array $onLongPressStart = null, |
|
20 | - public ?array $onLongPressEnd = null, |
|
21 | - ?array $onCancel = null, |
|
22 | - ?bool $when = null, |
|
23 | - ) { |
|
24 | - parent::__construct(GestureType::LONG_PRESS, $onCancel, $when); |
|
25 | - } |
|
26 | - |
|
27 | - public function jsonSerialize(): array |
|
28 | - { |
|
29 | - $data = parent::jsonSerialize(); |
|
30 | - |
|
31 | - if ($this->onLongPressStart !== null && !empty($this->onLongPressStart)) { |
|
32 | - $data['onLongPressStart'] = $this->onLongPressStart; |
|
18 | + public function __construct( |
|
19 | + public ?array $onLongPressStart = null, |
|
20 | + public ?array $onLongPressEnd = null, |
|
21 | + ?array $onCancel = null, |
|
22 | + ?bool $when = null, |
|
23 | + ) { |
|
24 | + parent::__construct(GestureType::LONG_PRESS, $onCancel, $when); |
|
33 | 25 | } |
34 | 26 | |
35 | - if ($this->onLongPressEnd !== null && !empty($this->onLongPressEnd)) { |
|
36 | - $data['onLongPressEnd'] = $this->onLongPressEnd; |
|
37 | - } |
|
27 | + public function jsonSerialize(): array |
|
28 | + { |
|
29 | + $data = parent::jsonSerialize(); |
|
38 | 30 | |
39 | - return $data; |
|
40 | - } |
|
31 | + if ($this->onLongPressStart !== null && !empty($this->onLongPressStart)) { |
|
32 | + $data['onLongPressStart'] = $this->onLongPressStart; |
|
33 | + } |
|
34 | + |
|
35 | + if ($this->onLongPressEnd !== null && !empty($this->onLongPressEnd)) { |
|
36 | + $data['onLongPressEnd'] = $this->onLongPressEnd; |
|
37 | + } |
|
38 | + |
|
39 | + return $data; |
|
40 | + } |
|
41 | 41 | } |
@@ -7,8 +7,7 @@ |
||
7 | 7 | use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
8 | 8 | use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
9 | 9 | |
10 | -class LongPress extends AbstractGesture |
|
11 | -{ |
|
10 | +class LongPress extends AbstractGesture { |
|
12 | 11 | /** |
13 | 12 | * @param AbstractStandardCommand[]|null $onLongPressStart Commands to run when long press starts |
14 | 13 | * @param AbstractStandardCommand[]|null $onLongPressEnd Commands to run when long press ends |
@@ -1,35 +1,35 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | + declare(strict_types=1); |
|
4 | 4 | |
5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
6 | 6 | |
7 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
8 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
8 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
9 | 9 | |
10 | -class Tap extends AbstractGesture |
|
11 | -{ |
|
12 | - /** |
|
10 | + class Tap extends AbstractGesture |
|
11 | + { |
|
12 | + /** |
|
13 | 13 | * @param AbstractStandardCommand[]|null $onTap Commands to run when a tap occurs |
14 | 14 | * @param AbstractStandardCommand[]|null $onCancel Commands to run when gesture is cancelled |
15 | 15 | * @param bool|null $when APL boolean expression controlling whether this gesture is active |
16 | 16 | */ |
17 | - public function __construct( |
|
18 | - public ?array $onTap = null, |
|
19 | - ?array $onCancel = null, |
|
20 | - ?bool $when = null, |
|
21 | - ) { |
|
22 | - parent::__construct(GestureType::TAP, $onCancel, $when); |
|
23 | - } |
|
17 | + public function __construct( |
|
18 | + public ?array $onTap = null, |
|
19 | + ?array $onCancel = null, |
|
20 | + ?bool $when = null, |
|
21 | + ) { |
|
22 | + parent::__construct(GestureType::TAP, $onCancel, $when); |
|
23 | + } |
|
24 | 24 | |
25 | - public function jsonSerialize(): array |
|
26 | - { |
|
27 | - $data = parent::jsonSerialize(); |
|
25 | + public function jsonSerialize(): array |
|
26 | + { |
|
27 | + $data = parent::jsonSerialize(); |
|
28 | 28 | |
29 | - if ($this->onTap !== null && !empty($this->onTap)) { |
|
30 | - $data['onTap'] = $this->onTap; |
|
31 | - } |
|
29 | + if ($this->onTap !== null && !empty($this->onTap)) { |
|
30 | + $data['onTap'] = $this->onTap; |
|
31 | + } |
|
32 | 32 | |
33 | - return $data; |
|
34 | - } |
|
33 | + return $data; |
|
34 | + } |
|
35 | 35 | } |
@@ -7,8 +7,7 @@ |
||
7 | 7 | use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
8 | 8 | use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
9 | 9 | |
10 | -class Tap extends AbstractGesture |
|
11 | -{ |
|
10 | +class Tap extends AbstractGesture { |
|
12 | 11 | /** |
13 | 12 | * @param AbstractStandardCommand[]|null $onTap Commands to run when a tap occurs |
14 | 13 | * @param AbstractStandardCommand[]|null $onCancel Commands to run when gesture is cancelled |
@@ -1,18 +1,18 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | + declare(strict_types=1); |
|
4 | 4 | |
5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
6 | 6 | |
7 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Component\APLBaseComponent; |
|
8 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
9 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\SwipeAction; |
|
10 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\SwipeDirection; |
|
11 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Component\APLBaseComponent; |
|
8 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
9 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\SwipeAction; |
|
10 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\SwipeDirection; |
|
11 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
12 | 12 | |
13 | -class SwipeAway extends AbstractGesture |
|
14 | -{ |
|
15 | - /** |
|
13 | + class SwipeAway extends AbstractGesture |
|
14 | + { |
|
15 | + /** |
|
16 | 16 | * @param SwipeDirection|null $direction Direction the user swipes to activate the gesture |
17 | 17 | * @param SwipeAction|null $action How to display the original and child components during the swipe gesture |
18 | 18 | * @param APLBaseComponent|null $item Single item to display during and after the swipe gesture |
@@ -22,47 +22,47 @@ discard block |
||
22 | 22 | * @param AbstractStandardCommand[]|null $onCancel Commands to run when gesture is cancelled |
23 | 23 | * @param bool|null $when APL boolean expression controlling whether this gesture is active |
24 | 24 | */ |
25 | - public function __construct( |
|
26 | - public ?SwipeDirection $direction = null, |
|
27 | - public ?SwipeAction $action = null, |
|
28 | - public ?APLBaseComponent $item = null, |
|
29 | - public ?array $items = null, |
|
30 | - public ?array $onSwipeMove = null, |
|
31 | - public ?array $onSwipeDone = null, |
|
32 | - ?array $onCancel = null, |
|
33 | - ?bool $when = null, |
|
34 | - ) { |
|
35 | - parent::__construct(GestureType::SWIPE_AWAY, $onCancel, $when); |
|
36 | - } |
|
25 | + public function __construct( |
|
26 | + public ?SwipeDirection $direction = null, |
|
27 | + public ?SwipeAction $action = null, |
|
28 | + public ?APLBaseComponent $item = null, |
|
29 | + public ?array $items = null, |
|
30 | + public ?array $onSwipeMove = null, |
|
31 | + public ?array $onSwipeDone = null, |
|
32 | + ?array $onCancel = null, |
|
33 | + ?bool $when = null, |
|
34 | + ) { |
|
35 | + parent::__construct(GestureType::SWIPE_AWAY, $onCancel, $when); |
|
36 | + } |
|
37 | 37 | |
38 | - public function jsonSerialize(): array |
|
39 | - { |
|
40 | - $data = parent::jsonSerialize(); |
|
38 | + public function jsonSerialize(): array |
|
39 | + { |
|
40 | + $data = parent::jsonSerialize(); |
|
41 | 41 | |
42 | - if ($this->direction !== null) { |
|
43 | - $data['direction'] = $this->direction->value; |
|
44 | - } |
|
42 | + if ($this->direction !== null) { |
|
43 | + $data['direction'] = $this->direction->value; |
|
44 | + } |
|
45 | 45 | |
46 | - if ($this->action !== null) { |
|
47 | - $data['action'] = $this->action->value; |
|
48 | - } |
|
46 | + if ($this->action !== null) { |
|
47 | + $data['action'] = $this->action->value; |
|
48 | + } |
|
49 | 49 | |
50 | - if ($this->item !== null) { |
|
51 | - $data['item'] = $this->item; |
|
52 | - } |
|
50 | + if ($this->item !== null) { |
|
51 | + $data['item'] = $this->item; |
|
52 | + } |
|
53 | 53 | |
54 | - if ($this->items !== null && !empty($this->items)) { |
|
55 | - $data['items'] = $this->items; |
|
56 | - } |
|
54 | + if ($this->items !== null && !empty($this->items)) { |
|
55 | + $data['items'] = $this->items; |
|
56 | + } |
|
57 | 57 | |
58 | - if ($this->onSwipeMove !== null && !empty($this->onSwipeMove)) { |
|
59 | - $data['onSwipeMove'] = $this->onSwipeMove; |
|
60 | - } |
|
58 | + if ($this->onSwipeMove !== null && !empty($this->onSwipeMove)) { |
|
59 | + $data['onSwipeMove'] = $this->onSwipeMove; |
|
60 | + } |
|
61 | 61 | |
62 | - if ($this->onSwipeDone !== null && !empty($this->onSwipeDone)) { |
|
63 | - $data['onSwipeDone'] = $this->onSwipeDone; |
|
64 | - } |
|
62 | + if ($this->onSwipeDone !== null && !empty($this->onSwipeDone)) { |
|
63 | + $data['onSwipeDone'] = $this->onSwipeDone; |
|
64 | + } |
|
65 | 65 | |
66 | - return $data; |
|
67 | - } |
|
66 | + return $data; |
|
67 | + } |
|
68 | 68 | } |
@@ -10,8 +10,7 @@ |
||
10 | 10 | use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\SwipeDirection; |
11 | 11 | use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
12 | 12 | |
13 | -class SwipeAway extends AbstractGesture |
|
14 | -{ |
|
13 | +class SwipeAway extends AbstractGesture { |
|
15 | 14 | /** |
16 | 15 | * @param SwipeDirection|null $direction Direction the user swipes to activate the gesture |
17 | 16 | * @param SwipeAction|null $action How to display the original and child components during the swipe gesture |
@@ -1,40 +1,40 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | + declare(strict_types=1); |
|
4 | 4 | |
5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Gesture; |
|
6 | 6 | |
7 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
8 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\GestureType; |
|
8 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
9 | 9 | |
10 | -abstract class AbstractGesture implements \JsonSerializable |
|
11 | -{ |
|
12 | - /** |
|
10 | + abstract class AbstractGesture implements \JsonSerializable |
|
11 | + { |
|
12 | + /** |
|
13 | 13 | * @param GestureType $type The type of gesture |
14 | 14 | * @param AbstractStandardCommand[]|null $onCancel Commands to run when gesture is cancelled |
15 | 15 | * @param bool|null $when APL boolean expression controlling whether this gesture is active |
16 | 16 | */ |
17 | - public function __construct( |
|
18 | - public GestureType $type, |
|
19 | - public ?array $onCancel = null, |
|
20 | - public ?bool $when = null, |
|
21 | - ) { |
|
22 | - } |
|
23 | - |
|
24 | - public function jsonSerialize(): array |
|
25 | - { |
|
26 | - $data = [ |
|
27 | - 'type' => $this->type->value, |
|
28 | - ]; |
|
29 | - |
|
30 | - if ($this->onCancel !== null && !empty($this->onCancel)) { |
|
31 | - $data['onCancel'] = $this->onCancel; |
|
17 | + public function __construct( |
|
18 | + public GestureType $type, |
|
19 | + public ?array $onCancel = null, |
|
20 | + public ?bool $when = null, |
|
21 | + ) { |
|
32 | 22 | } |
33 | 23 | |
34 | - if ($this->when !== null) { |
|
35 | - $data['when'] = $this->when; |
|
36 | - } |
|
24 | + public function jsonSerialize(): array |
|
25 | + { |
|
26 | + $data = [ |
|
27 | + 'type' => $this->type->value, |
|
28 | + ]; |
|
37 | 29 | |
38 | - return $data; |
|
39 | - } |
|
30 | + if ($this->onCancel !== null && !empty($this->onCancel)) { |
|
31 | + $data['onCancel'] = $this->onCancel; |
|
32 | + } |
|
33 | + |
|
34 | + if ($this->when !== null) { |
|
35 | + $data['when'] = $this->when; |
|
36 | + } |
|
37 | + |
|
38 | + return $data; |
|
39 | + } |
|
40 | 40 | } |
@@ -1,48 +1,48 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | + declare(strict_types=1); |
|
4 | 4 | |
5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
6 | 6 | |
7 | -class AutoPageCommand extends AbstractStandardCommand |
|
8 | -{ |
|
9 | - public const TYPE = 'AutoPage'; |
|
7 | + class AutoPageCommand extends AbstractStandardCommand |
|
8 | + { |
|
9 | + public const TYPE = 'AutoPage'; |
|
10 | 10 | |
11 | - /** |
|
11 | + /** |
|
12 | 12 | * @param string|null $componentId The ID of the component to auto-page |
13 | 13 | * @param int|null $count Number of pages to advance |
14 | 14 | * @param int|null $duration Duration of the auto-paging in milliseconds |
15 | 15 | * @param int|null $transitionDuration Duration of each page transition in milliseconds |
16 | 16 | */ |
17 | - 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 | - parent::__construct(self::TYPE); |
|
24 | - } |
|
25 | - |
|
26 | - public function jsonSerialize(): array |
|
27 | - { |
|
28 | - $data = parent::jsonSerialize(); |
|
29 | - |
|
30 | - if ($this->componentId !== null) { |
|
31 | - $data['componentId'] = $this->componentId; |
|
17 | + 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 | + parent::__construct(self::TYPE); |
|
32 | 24 | } |
33 | 25 | |
34 | - if ($this->count !== null) { |
|
35 | - $data['count'] = $this->count; |
|
36 | - } |
|
26 | + public function jsonSerialize(): array |
|
27 | + { |
|
28 | + $data = parent::jsonSerialize(); |
|
37 | 29 | |
38 | - if ($this->duration !== null) { |
|
39 | - $data['duration'] = $this->duration; |
|
40 | - } |
|
30 | + if ($this->componentId !== null) { |
|
31 | + $data['componentId'] = $this->componentId; |
|
32 | + } |
|
41 | 33 | |
42 | - if ($this->transitionDuration !== null) { |
|
43 | - $data['transitionDuration'] = $this->transitionDuration; |
|
44 | - } |
|
34 | + if ($this->count !== null) { |
|
35 | + $data['count'] = $this->count; |
|
36 | + } |
|
37 | + |
|
38 | + if ($this->duration !== null) { |
|
39 | + $data['duration'] = $this->duration; |
|
40 | + } |
|
45 | 41 | |
46 | - return $data; |
|
47 | - } |
|
42 | + if ($this->transitionDuration !== null) { |
|
43 | + $data['transitionDuration'] = $this->transitionDuration; |
|
44 | + } |
|
45 | + |
|
46 | + return $data; |
|
47 | + } |
|
48 | 48 | } |
@@ -4,8 +4,7 @@ |
||
4 | 4 | |
5 | 5 | namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
6 | 6 | |
7 | -class AutoPageCommand extends AbstractStandardCommand |
|
8 | -{ |
|
7 | +class AutoPageCommand extends AbstractStandardCommand { |
|
9 | 8 | public const TYPE = 'AutoPage'; |
10 | 9 | |
11 | 10 | /** |
@@ -1,30 +1,30 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | + declare(strict_types=1); |
|
4 | 4 | |
5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
6 | 6 | |
7 | -class SetFocusCommand extends AbstractStandardCommand implements \JsonSerializable |
|
8 | -{ |
|
9 | - public const TYPE = 'SetFocus'; |
|
7 | + class SetFocusCommand extends AbstractStandardCommand implements \JsonSerializable |
|
8 | + { |
|
9 | + public const TYPE = 'SetFocus'; |
|
10 | 10 | |
11 | - /** |
|
11 | + /** |
|
12 | 12 | * @param string|null $componentId ID of the component to set focus on |
13 | 13 | */ |
14 | - public function __construct( |
|
15 | - public ?string $componentId = null, |
|
16 | - ) { |
|
17 | - parent::__construct(self::TYPE); |
|
18 | - } |
|
14 | + public function __construct( |
|
15 | + public ?string $componentId = null, |
|
16 | + ) { |
|
17 | + parent::__construct(self::TYPE); |
|
18 | + } |
|
19 | 19 | |
20 | - public function jsonSerialize(): array |
|
21 | - { |
|
22 | - $data = parent::jsonSerialize(); |
|
20 | + public function jsonSerialize(): array |
|
21 | + { |
|
22 | + $data = parent::jsonSerialize(); |
|
23 | 23 | |
24 | - if ($this->componentId !== null) { |
|
25 | - $data['componentId'] = $this->componentId; |
|
26 | - } |
|
24 | + if ($this->componentId !== null) { |
|
25 | + $data['componentId'] = $this->componentId; |
|
26 | + } |
|
27 | 27 | |
28 | - return $data; |
|
29 | - } |
|
28 | + return $data; |
|
29 | + } |
|
30 | 30 | } |
@@ -1,54 +1,54 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | + declare(strict_types=1); |
|
4 | 4 | |
5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
6 | 6 | |
7 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\ScrollAlign; |
|
7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\ScrollAlign; |
|
8 | 8 | |
9 | -class SpeakListCommand extends AbstractStandardCommand implements \JsonSerializable |
|
10 | -{ |
|
11 | - public const TYPE = 'SpeakList'; |
|
9 | + class SpeakListCommand extends AbstractStandardCommand implements \JsonSerializable |
|
10 | + { |
|
11 | + public const TYPE = 'SpeakList'; |
|
12 | 12 | |
13 | - /** |
|
13 | + /** |
|
14 | 14 | * @param string|null $componentId ID of the component to speak |
15 | 15 | * @param ScrollAlign $align Alignment when scrolling to items |
16 | 16 | * @param int|null $count Number of items to speak |
17 | 17 | * @param int|null $minimumDwellTime Minimum time to dwell on each item in milliseconds |
18 | 18 | * @param int|null $start Starting index for speaking |
19 | 19 | */ |
20 | - 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 | - parent::__construct(self::TYPE); |
|
28 | - } |
|
29 | - |
|
30 | - public function jsonSerialize(): array |
|
31 | - { |
|
32 | - $data = parent::jsonSerialize(); |
|
33 | - |
|
34 | - if ($this->componentId !== null) { |
|
35 | - $data['componentId'] = $this->componentId; |
|
20 | + 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 | + parent::__construct(self::TYPE); |
|
36 | 28 | } |
37 | 29 | |
38 | - $data['align'] = $this->align->value; |
|
30 | + public function jsonSerialize(): array |
|
31 | + { |
|
32 | + $data = parent::jsonSerialize(); |
|
39 | 33 | |
40 | - if ($this->count !== null) { |
|
41 | - $data['count'] = $this->count; |
|
42 | - } |
|
34 | + if ($this->componentId !== null) { |
|
35 | + $data['componentId'] = $this->componentId; |
|
36 | + } |
|
43 | 37 | |
44 | - if ($this->minimumDwellTime !== null) { |
|
45 | - $data['minimumDwellTime'] = $this->minimumDwellTime; |
|
46 | - } |
|
38 | + $data['align'] = $this->align->value; |
|
47 | 39 | |
48 | - if ($this->start !== null) { |
|
49 | - $data['start'] = $this->start; |
|
50 | - } |
|
40 | + if ($this->count !== null) { |
|
41 | + $data['count'] = $this->count; |
|
42 | + } |
|
43 | + |
|
44 | + if ($this->minimumDwellTime !== null) { |
|
45 | + $data['minimumDwellTime'] = $this->minimumDwellTime; |
|
46 | + } |
|
51 | 47 | |
52 | - return $data; |
|
53 | - } |
|
48 | + if ($this->start !== null) { |
|
49 | + $data['start'] = $this->start; |
|
50 | + } |
|
51 | + |
|
52 | + return $data; |
|
53 | + } |
|
54 | 54 | } |
@@ -1,20 +1,20 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | + declare(strict_types=1); |
|
4 | 4 | |
5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
6 | 6 | |
7 | -class ClearFocusCommand extends AbstractStandardCommand |
|
8 | -{ |
|
9 | - public const TYPE = 'ClearFocus'; |
|
10 | - |
|
11 | - public function __construct() |
|
7 | + class ClearFocusCommand extends AbstractStandardCommand |
|
12 | 8 | { |
13 | - parent::__construct(self::TYPE); |
|
14 | - } |
|
9 | + public const TYPE = 'ClearFocus'; |
|
15 | 10 | |
16 | - public function jsonSerialize(): array |
|
17 | - { |
|
18 | - return parent::jsonSerialize(); |
|
19 | - } |
|
11 | + public function __construct() |
|
12 | + { |
|
13 | + parent::__construct(self::TYPE); |
|
14 | + } |
|
15 | + |
|
16 | + public function jsonSerialize(): array |
|
17 | + { |
|
18 | + return parent::jsonSerialize(); |
|
19 | + } |
|
20 | 20 | } |
@@ -4,12 +4,10 @@ |
||
4 | 4 | |
5 | 5 | namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
6 | 6 | |
7 | -class ClearFocusCommand extends AbstractStandardCommand |
|
8 | -{ |
|
7 | +class ClearFocusCommand extends AbstractStandardCommand { |
|
9 | 8 | public const TYPE = 'ClearFocus'; |
10 | 9 | |
11 | - public function __construct() |
|
12 | - { |
|
10 | + public function __construct() { |
|
13 | 11 | parent::__construct(self::TYPE); |
14 | 12 | } |
15 | 13 |