@@ -1,17 +1,17 @@ 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 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\RepeatMode; |
|
| 8 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\Value; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\RepeatMode; |
|
| 8 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\Value; |
|
| 9 | 9 | |
| 10 | -class AnimateItemCommand extends AbstractStandardCommand |
|
| 11 | -{ |
|
| 12 | - public const TYPE = 'AnimateItem'; |
|
| 10 | + class AnimateItemCommand extends AbstractStandardCommand |
|
| 11 | + { |
|
| 12 | + public const TYPE = 'AnimateItem'; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | + /** |
|
| 15 | 15 | * @param string|null $componentId The ID of the component to animate |
| 16 | 16 | * @param int|null $duration Duration of the animation in milliseconds |
| 17 | 17 | * @param string|null $easing Easing function for the animation |
@@ -19,45 +19,45 @@ discard block |
||
| 19 | 19 | * @param RepeatMode|null $repeatMode How to repeat the animation |
| 20 | 20 | * @param Value|null $value The property and values to animate |
| 21 | 21 | */ |
| 22 | - public function __construct( |
|
| 23 | - public ?string $componentId = null, |
|
| 24 | - public ?int $duration = null, |
|
| 25 | - public ?string $easing = null, |
|
| 26 | - public ?int $repeatCount = null, |
|
| 27 | - public ?RepeatMode $repeatMode = null, |
|
| 28 | - public ?Value $value = null, |
|
| 29 | - ) { |
|
| 30 | - parent::__construct(self::TYPE); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - public function jsonSerialize(): array |
|
| 34 | - { |
|
| 35 | - $data = parent::jsonSerialize(); |
|
| 36 | - |
|
| 37 | - if ($this->componentId !== null) { |
|
| 38 | - $data['componentId'] = $this->componentId; |
|
| 22 | + public function __construct( |
|
| 23 | + public ?string $componentId = null, |
|
| 24 | + public ?int $duration = null, |
|
| 25 | + public ?string $easing = null, |
|
| 26 | + public ?int $repeatCount = null, |
|
| 27 | + public ?RepeatMode $repeatMode = null, |
|
| 28 | + public ?Value $value = null, |
|
| 29 | + ) { |
|
| 30 | + parent::__construct(self::TYPE); |
|
| 39 | 31 | } |
| 40 | 32 | |
| 41 | - if ($this->duration !== null) { |
|
| 42 | - $data['duration'] = $this->duration; |
|
| 43 | - } |
|
| 33 | + public function jsonSerialize(): array |
|
| 34 | + { |
|
| 35 | + $data = parent::jsonSerialize(); |
|
| 44 | 36 | |
| 45 | - if ($this->easing !== null) { |
|
| 46 | - $data['easing'] = $this->easing; |
|
| 47 | - } |
|
| 37 | + if ($this->componentId !== null) { |
|
| 38 | + $data['componentId'] = $this->componentId; |
|
| 39 | + } |
|
| 48 | 40 | |
| 49 | - if ($this->repeatCount !== null) { |
|
| 50 | - $data['repeatCount'] = $this->repeatCount; |
|
| 51 | - } |
|
| 41 | + if ($this->duration !== null) { |
|
| 42 | + $data['duration'] = $this->duration; |
|
| 43 | + } |
|
| 52 | 44 | |
| 53 | - if ($this->repeatMode !== null) { |
|
| 54 | - $data['repeatMode'] = $this->repeatMode->value; |
|
| 55 | - } |
|
| 45 | + if ($this->easing !== null) { |
|
| 46 | + $data['easing'] = $this->easing; |
|
| 47 | + } |
|
| 56 | 48 | |
| 57 | - if ($this->value !== null) { |
|
| 58 | - $data['value'] = $this->value; |
|
| 59 | - } |
|
| 49 | + if ($this->repeatCount !== null) { |
|
| 50 | + $data['repeatCount'] = $this->repeatCount; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + if ($this->repeatMode !== null) { |
|
| 54 | + $data['repeatMode'] = $this->repeatMode->value; |
|
| 55 | + } |
|
| 60 | 56 | |
| 61 | - return $data; |
|
| 62 | - } |
|
| 57 | + if ($this->value !== null) { |
|
| 58 | + $data['value'] = $this->value; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + return $data; |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -1,23 +1,23 @@ |
||
| 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 | -abstract class AbstractStandardCommand implements \JsonSerializable |
|
| 8 | -{ |
|
| 9 | - /** |
|
| 7 | + abstract class AbstractStandardCommand implements \JsonSerializable |
|
| 8 | + { |
|
| 9 | + /** |
|
| 10 | 10 | * @param string $type The type of the command |
| 11 | 11 | */ |
| 12 | - public function __construct( |
|
| 13 | - public string $type, |
|
| 14 | - ) { |
|
| 15 | - } |
|
| 12 | + public function __construct( |
|
| 13 | + public string $type, |
|
| 14 | + ) { |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public function jsonSerialize(): array |
|
| 18 | - { |
|
| 19 | - return [ |
|
| 20 | - 'type' => $this->type, |
|
| 21 | - ]; |
|
| 22 | - } |
|
| 17 | + public function jsonSerialize(): array |
|
| 18 | + { |
|
| 19 | + return [ |
|
| 20 | + 'type' => $this->type, |
|
| 21 | + ]; |
|
| 22 | + } |
|
| 23 | 23 | } |
@@ -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 InsertItemCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'InsertItem'; |
|
| 7 | + class InsertItemCommand extends AbstractStandardCommand |
|
| 8 | + { |
|
| 9 | + public const TYPE = 'InsertItem'; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 11 | + /** |
|
| 12 | 12 | * @param int|null $at Index where to insert the item |
| 13 | 13 | * @param string|null $componentId The ID of the component to insert into |
| 14 | 14 | * @param mixed $item Single item/component to insert (can be array, object, or APL component) |
| 15 | 15 | * @param array|null $items Array of items/components to insert |
| 16 | 16 | */ |
| 17 | - public function __construct( |
|
| 18 | - public ?int $at = null, |
|
| 19 | - public ?string $componentId = null, |
|
| 20 | - public mixed $item = null, |
|
| 21 | - public ?array $items = null, |
|
| 22 | - ) { |
|
| 23 | - parent::__construct(self::TYPE); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - public function jsonSerialize(): array |
|
| 27 | - { |
|
| 28 | - $data = parent::jsonSerialize(); |
|
| 29 | - |
|
| 30 | - if ($this->at !== null) { |
|
| 31 | - $data['at'] = $this->at; |
|
| 17 | + public function __construct( |
|
| 18 | + public ?int $at = null, |
|
| 19 | + public ?string $componentId = null, |
|
| 20 | + public mixed $item = null, |
|
| 21 | + public ?array $items = null, |
|
| 22 | + ) { |
|
| 23 | + parent::__construct(self::TYPE); |
|
| 32 | 24 | } |
| 33 | 25 | |
| 34 | - if ($this->componentId !== null) { |
|
| 35 | - $data['componentId'] = $this->componentId; |
|
| 36 | - } |
|
| 26 | + public function jsonSerialize(): array |
|
| 27 | + { |
|
| 28 | + $data = parent::jsonSerialize(); |
|
| 37 | 29 | |
| 38 | - if ($this->item !== null) { |
|
| 39 | - $data['item'] = $this->item; |
|
| 40 | - } |
|
| 30 | + if ($this->at !== null) { |
|
| 31 | + $data['at'] = $this->at; |
|
| 32 | + } |
|
| 41 | 33 | |
| 42 | - if ($this->items !== null && !empty($this->items)) { |
|
| 43 | - $data['items'] = $this->items; |
|
| 44 | - } |
|
| 34 | + if ($this->componentId !== null) { |
|
| 35 | + $data['componentId'] = $this->componentId; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + if ($this->item !== null) { |
|
| 39 | + $data['item'] = $this->item; |
|
| 40 | + } |
|
| 45 | 41 | |
| 46 | - return $data; |
|
| 47 | - } |
|
| 42 | + if ($this->items !== null && !empty($this->items)) { |
|
| 43 | + $data['items'] = $this->items; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + return $data; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -1,44 +1,44 @@ |
||
| 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\Request\AudioTrack; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Request\AudioTrack; |
|
| 8 | 8 | |
| 9 | -class PlayMediaCommand extends AbstractStandardCommand |
|
| 10 | -{ |
|
| 11 | - public const TYPE = 'PlayMedia'; |
|
| 9 | + class PlayMediaCommand extends AbstractStandardCommand |
|
| 10 | + { |
|
| 11 | + public const TYPE = 'PlayMedia'; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * @param string|null $componentId ID of the component to play media on |
| 15 | 15 | * @param string|array|null $source Media source URL or array of sources |
| 16 | 16 | * @param AudioTrack|null $audioTrack Audio track to play on |
| 17 | 17 | */ |
| 18 | - public function __construct( |
|
| 19 | - public ?string $componentId = null, |
|
| 20 | - public string|array|null $source = null, |
|
| 21 | - public ?AudioTrack $audioTrack = 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 string|array|null $source = null, |
|
| 21 | + public ?AudioTrack $audioTrack = null, |
|
| 22 | + ) { |
|
| 23 | + parent::__construct(self::TYPE); |
|
| 32 | 24 | } |
| 33 | 25 | |
| 34 | - if ($this->source !== null) { |
|
| 35 | - $data['source'] = $this->source; |
|
| 36 | - } |
|
| 26 | + public function jsonSerialize(): array |
|
| 27 | + { |
|
| 28 | + $data = parent::jsonSerialize(); |
|
| 37 | 29 | |
| 38 | - if ($this->audioTrack !== null) { |
|
| 39 | - $data['audioTrack'] = $this->audioTrack->value; |
|
| 40 | - } |
|
| 30 | + if ($this->componentId !== null) { |
|
| 31 | + $data['componentId'] = $this->componentId; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + if ($this->source !== null) { |
|
| 35 | + $data['source'] = $this->source; |
|
| 36 | + } |
|
| 41 | 37 | |
| 42 | - return $data; |
|
| 43 | - } |
|
| 38 | + if ($this->audioTrack !== null) { |
|
| 39 | + $data['audioTrack'] = $this->audioTrack->value; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + return $data; |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -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 FinishCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'Finish'; |
|
| 10 | - |
|
| 11 | - public function __construct() |
|
| 7 | + class FinishCommand extends AbstractStandardCommand |
|
| 12 | 8 | { |
| 13 | - parent::__construct(self::TYPE); |
|
| 14 | - } |
|
| 9 | + public const TYPE = 'Finish'; |
|
| 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,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 RemoveItemCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'RemoveItem'; |
|
| 7 | + class RemoveItemCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | + { |
|
| 9 | + public const TYPE = 'RemoveItem'; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 11 | + /** |
|
| 12 | 12 | * @param string|null $componentId ID of the component to remove item from |
| 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,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 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\ScrollAlign; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\ScrollAlign; |
|
| 8 | 8 | |
| 9 | -class ScrollToIndexCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - public const TYPE = 'ScrollToIndex'; |
|
| 9 | + class ScrollToIndexCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + public const TYPE = 'ScrollToIndex'; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * @param string|null $componentId ID of the component to scroll |
| 15 | 15 | * @param int|null $index Index to scroll to |
| 16 | 16 | * @param ScrollAlign $align Alignment when scrolled to index |
| 17 | 17 | * @param int|null $targetDuration Duration of the scroll animation in milliseconds |
| 18 | 18 | */ |
| 19 | - public function __construct( |
|
| 20 | - public ?string $componentId = null, |
|
| 21 | - public ?int $index = null, |
|
| 22 | - public ScrollAlign $align = ScrollAlign::VISIBLE, |
|
| 23 | - public ?int $targetDuration = null, |
|
| 24 | - ) { |
|
| 25 | - parent::__construct(self::TYPE); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function jsonSerialize(): array |
|
| 29 | - { |
|
| 30 | - $data = parent::jsonSerialize(); |
|
| 31 | - |
|
| 32 | - if ($this->componentId !== null) { |
|
| 33 | - $data['componentId'] = $this->componentId; |
|
| 19 | + public function __construct( |
|
| 20 | + public ?string $componentId = null, |
|
| 21 | + public ?int $index = null, |
|
| 22 | + public ScrollAlign $align = ScrollAlign::VISIBLE, |
|
| 23 | + public ?int $targetDuration = null, |
|
| 24 | + ) { |
|
| 25 | + parent::__construct(self::TYPE); |
|
| 34 | 26 | } |
| 35 | 27 | |
| 36 | - if ($this->index !== null) { |
|
| 37 | - $data['index'] = $this->index; |
|
| 38 | - } |
|
| 28 | + public function jsonSerialize(): array |
|
| 29 | + { |
|
| 30 | + $data = parent::jsonSerialize(); |
|
| 39 | 31 | |
| 40 | - $data['align'] = $this->align->value; |
|
| 32 | + if ($this->componentId !== null) { |
|
| 33 | + $data['componentId'] = $this->componentId; |
|
| 34 | + } |
|
| 41 | 35 | |
| 42 | - if ($this->targetDuration !== null) { |
|
| 43 | - $data['targetDuration'] = $this->targetDuration; |
|
| 44 | - } |
|
| 36 | + if ($this->index !== null) { |
|
| 37 | + $data['index'] = $this->index; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + $data['align'] = $this->align->value; |
|
| 45 | 41 | |
| 46 | - return $data; |
|
| 47 | - } |
|
| 42 | + if ($this->targetDuration !== null) { |
|
| 43 | + $data['targetDuration'] = $this->targetDuration; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + return $data; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -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\LogLevel; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\LogLevel; |
|
| 8 | 8 | |
| 9 | -class LogCommand extends AbstractStandardCommand |
|
| 10 | -{ |
|
| 11 | - public const TYPE = 'Log'; |
|
| 9 | + class LogCommand extends AbstractStandardCommand |
|
| 10 | + { |
|
| 11 | + public const TYPE = 'Log'; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * @param LogLevel $level Log level for the message |
| 15 | 15 | * @param string|null $message Message to log |
| 16 | 16 | * @param array|null $arguments Optional map of key-value pairs for data-binding |
| 17 | 17 | */ |
| 18 | - public function __construct( |
|
| 19 | - public LogLevel $level = LogLevel::INFO, |
|
| 20 | - public ?string $message = null, |
|
| 21 | - public ?array $arguments = null, |
|
| 22 | - ) { |
|
| 23 | - parent::__construct(self::TYPE); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - public function jsonSerialize(): array |
|
| 27 | - { |
|
| 28 | - $data = parent::jsonSerialize(); |
|
| 18 | + public function __construct( |
|
| 19 | + public LogLevel $level = LogLevel::INFO, |
|
| 20 | + public ?string $message = null, |
|
| 21 | + public ?array $arguments = null, |
|
| 22 | + ) { |
|
| 23 | + parent::__construct(self::TYPE); |
|
| 24 | + } |
|
| 29 | 25 | |
| 30 | - $data['level'] = $this->level->value; |
|
| 26 | + public function jsonSerialize(): array |
|
| 27 | + { |
|
| 28 | + $data = parent::jsonSerialize(); |
|
| 31 | 29 | |
| 32 | - if ($this->message !== null) { |
|
| 33 | - $data['message'] = $this->message; |
|
| 34 | - } |
|
| 30 | + $data['level'] = $this->level->value; |
|
| 35 | 31 | |
| 36 | - if ($this->arguments !== null && !empty($this->arguments)) { |
|
| 37 | - $data['arguments'] = $this->arguments; |
|
| 38 | - } |
|
| 32 | + if ($this->message !== null) { |
|
| 33 | + $data['message'] = $this->message; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + if ($this->arguments !== null && !empty($this->arguments)) { |
|
| 37 | + $data['arguments'] = $this->arguments; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return $data; |
|
| 41 | - } |
|
| 40 | + return $data; |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -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 | -class SendEventCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'SendEvent'; |
|
| 7 | + class SendEventCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | + { |
|
| 9 | + public const TYPE = 'SendEvent'; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 11 | + /** |
|
| 12 | 12 | * @param array|null $arguments Array of arguments to send with the event |
| 13 | 13 | * @param array|null $components Array of components related to the event |
| 14 | 14 | * @param array|null $flags Flags including interaction mode settings |
| 15 | 15 | */ |
| 16 | - public function __construct( |
|
| 17 | - public ?array $arguments = null, |
|
| 18 | - public ?array $components = null, |
|
| 19 | - public ?array $flags = null, |
|
| 20 | - ) { |
|
| 21 | - parent::__construct(self::TYPE); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - public function jsonSerialize(): array |
|
| 25 | - { |
|
| 26 | - $data = parent::jsonSerialize(); |
|
| 27 | - |
|
| 28 | - if ($this->arguments !== null && !empty($this->arguments)) { |
|
| 29 | - $data['arguments'] = $this->arguments; |
|
| 16 | + public function __construct( |
|
| 17 | + public ?array $arguments = null, |
|
| 18 | + public ?array $components = null, |
|
| 19 | + public ?array $flags = null, |
|
| 20 | + ) { |
|
| 21 | + parent::__construct(self::TYPE); |
|
| 30 | 22 | } |
| 31 | 23 | |
| 32 | - if ($this->components !== null && !empty($this->components)) { |
|
| 33 | - $data['components'] = $this->components; |
|
| 34 | - } |
|
| 24 | + public function jsonSerialize(): array |
|
| 25 | + { |
|
| 26 | + $data = parent::jsonSerialize(); |
|
| 35 | 27 | |
| 36 | - if ($this->flags !== null && !empty($this->flags)) { |
|
| 37 | - $data['flags'] = $this->flags; |
|
| 38 | - } |
|
| 28 | + if ($this->arguments !== null && !empty($this->arguments)) { |
|
| 29 | + $data['arguments'] = $this->arguments; |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + if ($this->components !== null && !empty($this->components)) { |
|
| 33 | + $data['components'] = $this->components; |
|
| 34 | + } |
|
| 39 | 35 | |
| 40 | - return $data; |
|
| 41 | - } |
|
| 36 | + if ($this->flags !== null && !empty($this->flags)) { |
|
| 37 | + $data['flags'] = $this->flags; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + return $data; |
|
| 41 | + } |
|
| 42 | 42 | } |