@@ -1,13 +1,13 @@ |
||
| 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\Document; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Document; |
|
| 6 | 6 | |
| 7 | -enum GestureType: string |
|
| 8 | -{ |
|
| 9 | - case DOUBLE_PRESS = 'DoublePress'; |
|
| 10 | - case LONG_PRESS = 'LongPress'; |
|
| 11 | - case SWIPE_AWAY = 'SwipeAway'; |
|
| 12 | - case TAP = 'Tap'; |
|
| 7 | + enum GestureType: string |
|
| 8 | + { |
|
| 9 | + case DOUBLE_PRESS = 'DoublePress'; |
|
| 10 | + case LONG_PRESS = 'LongPress'; |
|
| 11 | + case SWIPE_AWAY = 'SwipeAway'; |
|
| 12 | + case TAP = 'Tap'; |
|
| 13 | 13 | } |
@@ -1,22 +1,22 @@ |
||
| 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\Document; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Document; |
|
| 6 | 6 | |
| 7 | -enum APLComponentType: string |
|
| 8 | -{ |
|
| 9 | - case CONTAINER = 'Container'; |
|
| 10 | - case EDIT_TEXT = 'EditText'; |
|
| 11 | - case FLEX_SEQUENCE = 'FlexSequence'; |
|
| 12 | - case FRAME = 'Frame'; |
|
| 13 | - case GRID_SEQUENCE = 'GridSequence'; |
|
| 14 | - case IMAGE = 'Image'; |
|
| 15 | - case PAGER = 'Pager'; |
|
| 16 | - case SCROLL_VIEW = 'ScrollView'; |
|
| 17 | - case SEQUENCE = 'Sequence'; |
|
| 18 | - case TEXT = 'Text'; |
|
| 19 | - case TOUCH_WRAPPER = 'TouchWrapper'; |
|
| 20 | - case VECTOR_GRAPHIC = 'VectorGraphic'; |
|
| 21 | - case VIDEO = 'Video'; |
|
| 7 | + enum APLComponentType: string |
|
| 8 | + { |
|
| 9 | + case CONTAINER = 'Container'; |
|
| 10 | + case EDIT_TEXT = 'EditText'; |
|
| 11 | + case FLEX_SEQUENCE = 'FlexSequence'; |
|
| 12 | + case FRAME = 'Frame'; |
|
| 13 | + case GRID_SEQUENCE = 'GridSequence'; |
|
| 14 | + case IMAGE = 'Image'; |
|
| 15 | + case PAGER = 'Pager'; |
|
| 16 | + case SCROLL_VIEW = 'ScrollView'; |
|
| 17 | + case SEQUENCE = 'Sequence'; |
|
| 18 | + case TEXT = 'Text'; |
|
| 19 | + case TOUCH_WRAPPER = 'TouchWrapper'; |
|
| 20 | + case VECTOR_GRAPHIC = 'VectorGraphic'; |
|
| 21 | + case VIDEO = 'Video'; |
|
| 22 | 22 | } |
@@ -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 | } |
@@ -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 | /** |
@@ -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 | |