@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -1,42 +1,42 @@ |
||
| 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 ScrollToComponentCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - public const TYPE = 'ScrollToComponent'; |
|
| 9 | + class ScrollToComponentCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + public const TYPE = 'ScrollToComponent'; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * @param string|null $componentId ID of the component to scroll to |
| 15 | 15 | * @param ScrollAlign $align Alignment of the component when scrolled to |
| 16 | 16 | * @param int|null $targetDuration Duration of the scroll animation in milliseconds |
| 17 | 17 | */ |
| 18 | - public function __construct( |
|
| 19 | - public ?string $componentId = null, |
|
| 20 | - public ScrollAlign $align = ScrollAlign::VISIBLE, |
|
| 21 | - public ?int $targetDuration = 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; |
|
| 18 | + public function __construct( |
|
| 19 | + public ?string $componentId = null, |
|
| 20 | + public ScrollAlign $align = ScrollAlign::VISIBLE, |
|
| 21 | + public ?int $targetDuration = null, |
|
| 22 | + ) { |
|
| 23 | + parent::__construct(self::TYPE); |
|
| 32 | 24 | } |
| 33 | 25 | |
| 34 | - $data['align'] = $this->align->value; |
|
| 26 | + public function jsonSerialize(): array |
|
| 27 | + { |
|
| 28 | + $data = parent::jsonSerialize(); |
|
| 35 | 29 | |
| 36 | - if ($this->targetDuration !== null) { |
|
| 37 | - $data['targetDuration'] = $this->targetDuration; |
|
| 38 | - } |
|
| 30 | + if ($this->componentId !== null) { |
|
| 31 | + $data['componentId'] = $this->componentId; |
|
| 32 | + } |
|
| 39 | 33 | |
| 40 | - return $data; |
|
| 41 | - } |
|
| 34 | + $data['align'] = $this->align->value; |
|
| 35 | + |
|
| 36 | + if ($this->targetDuration !== null) { |
|
| 37 | + $data['targetDuration'] = $this->targetDuration; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + return $data; |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -1,14 +1,14 @@ 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\StandardCommand; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
|
| 6 | 6 | |
| 7 | -class ImportPackageCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'ImportPackage'; |
|
| 7 | + class ImportPackageCommand extends AbstractStandardCommand |
|
| 8 | + { |
|
| 9 | + public const TYPE = 'ImportPackage'; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 11 | + /** |
|
| 12 | 12 | * @param string|null $accept Package accept property |
| 13 | 13 | * @param string|null $name Package name property |
| 14 | 14 | * @param AbstractStandardCommand[]|null $onFail Commands to run if import fails |
@@ -16,45 +16,45 @@ discard block |
||
| 16 | 16 | * @param string|null $source Package source property |
| 17 | 17 | * @param string|null $version Package version property |
| 18 | 18 | */ |
| 19 | - public function __construct( |
|
| 20 | - public ?string $accept = null, |
|
| 21 | - public ?string $name = null, |
|
| 22 | - public ?array $onFail = null, |
|
| 23 | - public ?array $onLoad = null, |
|
| 24 | - public ?string $source = null, |
|
| 25 | - public ?string $version = null, |
|
| 26 | - ) { |
|
| 27 | - parent::__construct(self::TYPE); |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function jsonSerialize(): array |
|
| 31 | - { |
|
| 32 | - $data = parent::jsonSerialize(); |
|
| 33 | - |
|
| 34 | - if ($this->accept !== null) { |
|
| 35 | - $data['accept'] = $this->accept; |
|
| 19 | + public function __construct( |
|
| 20 | + public ?string $accept = null, |
|
| 21 | + public ?string $name = null, |
|
| 22 | + public ?array $onFail = null, |
|
| 23 | + public ?array $onLoad = null, |
|
| 24 | + public ?string $source = null, |
|
| 25 | + public ?string $version = null, |
|
| 26 | + ) { |
|
| 27 | + parent::__construct(self::TYPE); |
|
| 36 | 28 | } |
| 37 | 29 | |
| 38 | - if ($this->name !== null) { |
|
| 39 | - $data['name'] = $this->name; |
|
| 40 | - } |
|
| 30 | + public function jsonSerialize(): array |
|
| 31 | + { |
|
| 32 | + $data = parent::jsonSerialize(); |
|
| 41 | 33 | |
| 42 | - if ($this->onFail !== null && !empty($this->onFail)) { |
|
| 43 | - $data['onFail'] = $this->onFail; |
|
| 44 | - } |
|
| 34 | + if ($this->accept !== null) { |
|
| 35 | + $data['accept'] = $this->accept; |
|
| 36 | + } |
|
| 45 | 37 | |
| 46 | - if ($this->onLoad !== null && !empty($this->onLoad)) { |
|
| 47 | - $data['onLoad'] = $this->onLoad; |
|
| 48 | - } |
|
| 38 | + if ($this->name !== null) { |
|
| 39 | + $data['name'] = $this->name; |
|
| 40 | + } |
|
| 49 | 41 | |
| 50 | - if ($this->source !== null) { |
|
| 51 | - $data['source'] = $this->source; |
|
| 52 | - } |
|
| 42 | + if ($this->onFail !== null && !empty($this->onFail)) { |
|
| 43 | + $data['onFail'] = $this->onFail; |
|
| 44 | + } |
|
| 53 | 45 | |
| 54 | - if ($this->version !== null) { |
|
| 55 | - $data['version'] = $this->version; |
|
| 56 | - } |
|
| 46 | + if ($this->onLoad !== null && !empty($this->onLoad)) { |
|
| 47 | + $data['onLoad'] = $this->onLoad; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + if ($this->source !== null) { |
|
| 51 | + $data['source'] = $this->source; |
|
| 52 | + } |
|
| 57 | 53 | |
| 58 | - return $data; |
|
| 59 | - } |
|
| 54 | + if ($this->version !== null) { |
|
| 55 | + $data['version'] = $this->version; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + return $data; |
|
| 59 | + } |
|
| 60 | 60 | } |