@@ -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 | } |
@@ -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 | } |
@@ -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,25 +1,25 @@ |
||
| 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\AVGFilter; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\AVGFilter; |
|
| 6 | 6 | |
| 7 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\AVGFilterType; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\AVGFilterType; |
|
| 8 | 8 | |
| 9 | -abstract class AVGFilter implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - /** |
|
| 9 | + abstract class AVGFilter implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + /** |
|
| 12 | 12 | * @param AVGFilterType $type The type of the AVG filter |
| 13 | 13 | */ |
| 14 | - public function __construct( |
|
| 15 | - public AVGFilterType $type, |
|
| 16 | - ) { |
|
| 17 | - } |
|
| 14 | + public function __construct( |
|
| 15 | + public AVGFilterType $type, |
|
| 16 | + ) { |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function jsonSerialize(): array |
|
| 20 | - { |
|
| 21 | - return [ |
|
| 22 | - 'type' => $this->type->value, |
|
| 23 | - ]; |
|
| 24 | - } |
|
| 19 | + public function jsonSerialize(): array |
|
| 20 | + { |
|
| 21 | + return [ |
|
| 22 | + 'type' => $this->type->value, |
|
| 23 | + ]; |
|
| 24 | + } |
|
| 25 | 25 | } |
@@ -1,50 +1,50 @@ |
||
| 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\AVGFilter; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\AVGFilter; |
|
| 6 | 6 | |
| 7 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\AVGFilterType; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\AVGFilterType; |
|
| 8 | 8 | |
| 9 | -class DropShadow extends AVGFilter implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - public const TYPE = AVGFilterType::DROP_SHADOW; |
|
| 9 | + class DropShadow extends AVGFilter implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + public const TYPE = AVGFilterType::DROP_SHADOW; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * @param string|null $color Color of the drop shadow |
| 15 | 15 | * @param int|null $horizontalOffset Horizontal offset of the shadow |
| 16 | 16 | * @param int|null $radius Blur radius of the shadow |
| 17 | 17 | * @param int|null $verticalOffset Vertical offset of the shadow |
| 18 | 18 | */ |
| 19 | - public function __construct( |
|
| 20 | - public ?string $color = null, |
|
| 21 | - public ?int $horizontalOffset = null, |
|
| 22 | - public ?int $radius = null, |
|
| 23 | - public ?int $verticalOffset = null, |
|
| 24 | - ) { |
|
| 25 | - parent::__construct(self::TYPE); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function jsonSerialize(): array |
|
| 29 | - { |
|
| 30 | - $data = parent::jsonSerialize(); |
|
| 31 | - |
|
| 32 | - if ($this->color !== null) { |
|
| 33 | - $data['color'] = $this->color; |
|
| 19 | + public function __construct( |
|
| 20 | + public ?string $color = null, |
|
| 21 | + public ?int $horizontalOffset = null, |
|
| 22 | + public ?int $radius = null, |
|
| 23 | + public ?int $verticalOffset = null, |
|
| 24 | + ) { |
|
| 25 | + parent::__construct(self::TYPE); |
|
| 34 | 26 | } |
| 35 | 27 | |
| 36 | - if ($this->horizontalOffset !== null) { |
|
| 37 | - $data['horizontalOffset'] = $this->horizontalOffset; |
|
| 38 | - } |
|
| 28 | + public function jsonSerialize(): array |
|
| 29 | + { |
|
| 30 | + $data = parent::jsonSerialize(); |
|
| 39 | 31 | |
| 40 | - if ($this->radius !== null) { |
|
| 41 | - $data['radius'] = $this->radius; |
|
| 42 | - } |
|
| 32 | + if ($this->color !== null) { |
|
| 33 | + $data['color'] = $this->color; |
|
| 34 | + } |
|
| 43 | 35 | |
| 44 | - if ($this->verticalOffset !== null) { |
|
| 45 | - $data['verticalOffset'] = $this->verticalOffset; |
|
| 46 | - } |
|
| 36 | + if ($this->horizontalOffset !== null) { |
|
| 37 | + $data['horizontalOffset'] = $this->horizontalOffset; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + if ($this->radius !== null) { |
|
| 41 | + $data['radius'] = $this->radius; |
|
| 42 | + } |
|
| 47 | 43 | |
| 48 | - return $data; |
|
| 49 | - } |
|
| 44 | + if ($this->verticalOffset !== null) { |
|
| 45 | + $data['verticalOffset'] = $this->verticalOffset; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + return $data; |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -1,14 +1,14 @@ |
||
| 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; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL; |
|
| 6 | 6 | |
| 7 | -enum UpdateIndexListDataOperationType: string |
|
| 8 | -{ |
|
| 9 | - case INSERT_ITEM = 'InsertItem'; |
|
| 10 | - case INSERT_MULTIPLE_ITEMS = 'InsertMultipleItems'; |
|
| 11 | - case SET_ITEM = 'SetItem'; |
|
| 12 | - case DELETE_ITEM = 'DeleteItem'; |
|
| 13 | - case DELETE_MULTIPLE_ITEMS = 'DeleteMultipleItems'; |
|
| 7 | + enum UpdateIndexListDataOperationType: string |
|
| 8 | + { |
|
| 9 | + case INSERT_ITEM = 'InsertItem'; |
|
| 10 | + case INSERT_MULTIPLE_ITEMS = 'InsertMultipleItems'; |
|
| 11 | + case SET_ITEM = 'SetItem'; |
|
| 12 | + case DELETE_ITEM = 'DeleteItem'; |
|
| 13 | + case DELETE_MULTIPLE_ITEMS = 'DeleteMultipleItems'; |
|
| 14 | 14 | } |
@@ -1,57 +1,57 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | + declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | -namespace MaxBeckers\AmazonAlexa\Response\Directives\Display; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\Display; |
|
| 6 | 6 | |
| 7 | -use MaxBeckers\AmazonAlexa\Helper\SerializeValueMapper; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Helper\SerializeValueMapper; |
|
| 8 | 8 | |
| 9 | -class Template implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - use SerializeValueMapper; |
|
| 9 | + class Template implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + use SerializeValueMapper; |
|
| 12 | + |
|
| 13 | + public const BACK_BUTTON_MODE_HIDDEN = 'HIDDEN'; |
|
| 14 | + public const BACK_BUTTON_MODE_VISIBLE = 'VISIBLE'; |
|
| 15 | + |
|
| 16 | + /** @var ListItem[] */ |
|
| 17 | + public function __construct( |
|
| 18 | + public ?string $type = null, |
|
| 19 | + public ?string $token = null, |
|
| 20 | + public ?string $backButton = null, |
|
| 21 | + public ?Image $backgroundImage = null, |
|
| 22 | + public ?string $title = null, |
|
| 23 | + public ?TextContent $textContent = null, |
|
| 24 | + public ?Image $image = null, |
|
| 25 | + public array $listItems = [] |
|
| 26 | + ) { |
|
| 27 | + } |
|
| 12 | 28 | |
| 13 | - public const BACK_BUTTON_MODE_HIDDEN = 'HIDDEN'; |
|
| 14 | - public const BACK_BUTTON_MODE_VISIBLE = 'VISIBLE'; |
|
| 29 | + public function addListItem(ListItem $item): void |
|
| 30 | + { |
|
| 31 | + $this->listItems[] = $item; |
|
| 32 | + } |
|
| 15 | 33 | |
| 16 | - /** @var ListItem[] */ |
|
| 17 | - public function __construct( |
|
| 18 | - public ?string $type = null, |
|
| 19 | - public ?string $token = null, |
|
| 20 | - public ?string $backButton = null, |
|
| 21 | - public ?Image $backgroundImage = null, |
|
| 22 | - public ?string $title = null, |
|
| 23 | - public ?TextContent $textContent = null, |
|
| 24 | - public ?Image $image = null, |
|
| 25 | - public array $listItems = [] |
|
| 26 | - ) { |
|
| 27 | - } |
|
| 34 | + public static function create($type, $token, $backButton = self::BACK_BUTTON_MODE_VISIBLE, $backgroundImage = null, $title = null, $textContent = null, $image = null, $listItems = []): self |
|
| 35 | + { |
|
| 36 | + return new self($type, $token, $backButton, $backgroundImage, $title, $textContent, $image, $listItems); |
|
| 37 | + } |
|
| 28 | 38 | |
| 29 | - public function addListItem(ListItem $item): void |
|
| 30 | - { |
|
| 31 | - $this->listItems[] = $item; |
|
| 32 | - } |
|
| 39 | + public function jsonSerialize(): \ArrayObject |
|
| 40 | + { |
|
| 41 | + $data = new \ArrayObject(); |
|
| 33 | 42 | |
| 34 | - public static function create($type, $token, $backButton = self::BACK_BUTTON_MODE_VISIBLE, $backgroundImage = null, $title = null, $textContent = null, $image = null, $listItems = []): self |
|
| 35 | - { |
|
| 36 | - return new self($type, $token, $backButton, $backgroundImage, $title, $textContent, $image, $listItems); |
|
| 37 | - } |
|
| 43 | + $this->valueToArrayIfSet($data, 'type'); |
|
| 44 | + $this->valueToArrayIfSet($data, 'token'); |
|
| 45 | + $this->valueToArrayIfSet($data, 'backButton'); |
|
| 46 | + $this->valueToArrayIfSet($data, 'backgroundImage'); |
|
| 47 | + $this->valueToArrayIfSet($data, 'title'); |
|
| 48 | + $this->valueToArrayIfSet($data, 'textContent'); |
|
| 49 | + $this->valueToArrayIfSet($data, 'image'); |
|
| 38 | 50 | |
| 39 | - public function jsonSerialize(): \ArrayObject |
|
| 40 | - { |
|
| 41 | - $data = new \ArrayObject(); |
|
| 42 | - |
|
| 43 | - $this->valueToArrayIfSet($data, 'type'); |
|
| 44 | - $this->valueToArrayIfSet($data, 'token'); |
|
| 45 | - $this->valueToArrayIfSet($data, 'backButton'); |
|
| 46 | - $this->valueToArrayIfSet($data, 'backgroundImage'); |
|
| 47 | - $this->valueToArrayIfSet($data, 'title'); |
|
| 48 | - $this->valueToArrayIfSet($data, 'textContent'); |
|
| 49 | - $this->valueToArrayIfSet($data, 'image'); |
|
| 50 | - |
|
| 51 | - if (!empty($this->listItems)) { |
|
| 52 | - $data['listItems'] = $this->listItems; |
|
| 53 | - } |
|
| 51 | + if (!empty($this->listItems)) { |
|
| 52 | + $data['listItems'] = $this->listItems; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - return $data; |
|
| 56 | - } |
|
| 55 | + return $data; |
|
| 56 | + } |
|
| 57 | 57 | } |