@@ -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 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
| 6 | 6 | |
| 7 | -class ImportPackageCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 7 | +class ImportPackageCommand extends AbstractStandardCommand { |
|
| 9 | 8 | public const TYPE = 'ImportPackage'; |
| 10 | 9 | |
| 11 | 10 | /** |
@@ -1,36 +1,36 @@ |
||
| 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 OpenURLCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'OpenURL'; |
|
| 7 | + class OpenURLCommand extends AbstractStandardCommand |
|
| 8 | + { |
|
| 9 | + public const TYPE = 'OpenURL'; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 11 | + /** |
|
| 12 | 12 | * @param string|null $source URL to open |
| 13 | 13 | * @param AbstractStandardCommand|AbstractStandardCommand[]|null $onFail Commands to run if URL can't be opened |
| 14 | 14 | */ |
| 15 | - public function __construct( |
|
| 16 | - public ?string $source = null, |
|
| 17 | - public mixed $onFail = null, |
|
| 18 | - ) { |
|
| 19 | - parent::__construct(self::TYPE); |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - public function jsonSerialize(): array |
|
| 23 | - { |
|
| 24 | - $data = parent::jsonSerialize(); |
|
| 25 | - |
|
| 26 | - if ($this->source !== null) { |
|
| 27 | - $data['source'] = $this->source; |
|
| 15 | + public function __construct( |
|
| 16 | + public ?string $source = null, |
|
| 17 | + public mixed $onFail = null, |
|
| 18 | + ) { |
|
| 19 | + parent::__construct(self::TYPE); |
|
| 28 | 20 | } |
| 29 | 21 | |
| 30 | - if ($this->onFail !== null) { |
|
| 31 | - $data['onFail'] = $this->onFail; |
|
| 32 | - } |
|
| 22 | + public function jsonSerialize(): array |
|
| 23 | + { |
|
| 24 | + $data = parent::jsonSerialize(); |
|
| 33 | 25 | |
| 34 | - return $data; |
|
| 35 | - } |
|
| 26 | + if ($this->source !== null) { |
|
| 27 | + $data['source'] = $this->source; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + if ($this->onFail !== null) { |
|
| 31 | + $data['onFail'] = $this->onFail; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + return $data; |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
| 6 | 6 | |
| 7 | -class OpenURLCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 7 | +class OpenURLCommand extends AbstractStandardCommand { |
|
| 9 | 8 | public const TYPE = 'OpenURL'; |
| 10 | 9 | |
| 11 | 10 | /** |
@@ -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\Response\Directives\APL\Document\ControlMediaCommand as ControlMediaCommandType; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\ControlMediaCommand as ControlMediaCommandType; |
|
| 8 | 8 | |
| 9 | -class ControlMediaCommand extends AbstractStandardCommand |
|
| 10 | -{ |
|
| 11 | - public const TYPE = 'ControlMedia'; |
|
| 9 | + class ControlMediaCommand extends AbstractStandardCommand |
|
| 10 | + { |
|
| 11 | + public const TYPE = 'ControlMedia'; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * @param ControlMediaCommandType|null $command The media control command to execute |
| 15 | 15 | * @param string|null $componentId The ID of the component to control |
| 16 | 16 | * @param int|null $value Integer value for commands that require it |
| 17 | 17 | */ |
| 18 | - public function __construct( |
|
| 19 | - public ?ControlMediaCommandType $command = null, |
|
| 20 | - public ?string $componentId = null, |
|
| 21 | - public ?int $value = null, |
|
| 22 | - ) { |
|
| 23 | - parent::__construct(self::TYPE); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - public function jsonSerialize(): array |
|
| 27 | - { |
|
| 28 | - $data = parent::jsonSerialize(); |
|
| 29 | - |
|
| 30 | - if ($this->command !== null) { |
|
| 31 | - $data['command'] = $this->command->value; |
|
| 18 | + public function __construct( |
|
| 19 | + public ?ControlMediaCommandType $command = null, |
|
| 20 | + public ?string $componentId = null, |
|
| 21 | + public ?int $value = 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->value !== null) { |
|
| 39 | - $data['value'] = $this->value; |
|
| 40 | - } |
|
| 30 | + if ($this->command !== null) { |
|
| 31 | + $data['command'] = $this->command->value; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + if ($this->componentId !== null) { |
|
| 35 | + $data['componentId'] = $this->componentId; |
|
| 36 | + } |
|
| 41 | 37 | |
| 42 | - return $data; |
|
| 43 | - } |
|
| 38 | + if ($this->value !== null) { |
|
| 39 | + $data['value'] = $this->value; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + return $data; |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -6,8 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\ControlMediaCommand as ControlMediaCommandType; |
| 8 | 8 | |
| 9 | -class ControlMediaCommand extends AbstractStandardCommand |
|
| 10 | -{ |
|
| 9 | +class ControlMediaCommand extends AbstractStandardCommand { |
|
| 11 | 10 | public const TYPE = 'ControlMedia'; |
| 12 | 11 | |
| 13 | 12 | /** |
@@ -1,36 +1,36 @@ |
||
| 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 ParallelCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'Parallel'; |
|
| 7 | + class ParallelCommand extends AbstractStandardCommand |
|
| 8 | + { |
|
| 9 | + public const TYPE = 'Parallel'; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 11 | + /** |
|
| 12 | 12 | * @param array|null $data Array of data to iterate over |
| 13 | 13 | * @param AbstractStandardCommand[]|null $commands Commands to run in parallel |
| 14 | 14 | */ |
| 15 | - public function __construct( |
|
| 16 | - public ?array $data = null, |
|
| 17 | - public ?array $commands = null, |
|
| 18 | - ) { |
|
| 19 | - parent::__construct(self::TYPE); |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - public function jsonSerialize(): array |
|
| 23 | - { |
|
| 24 | - $data = parent::jsonSerialize(); |
|
| 25 | - |
|
| 26 | - if ($this->data !== null && !empty($this->data)) { |
|
| 27 | - $data['data'] = $this->data; |
|
| 15 | + public function __construct( |
|
| 16 | + public ?array $data = null, |
|
| 17 | + public ?array $commands = null, |
|
| 18 | + ) { |
|
| 19 | + parent::__construct(self::TYPE); |
|
| 28 | 20 | } |
| 29 | 21 | |
| 30 | - if ($this->commands !== null && !empty($this->commands)) { |
|
| 31 | - $data['commands'] = $this->commands; |
|
| 32 | - } |
|
| 22 | + public function jsonSerialize(): array |
|
| 23 | + { |
|
| 24 | + $data = parent::jsonSerialize(); |
|
| 33 | 25 | |
| 34 | - return $data; |
|
| 35 | - } |
|
| 26 | + if ($this->data !== null && !empty($this->data)) { |
|
| 27 | + $data['data'] = $this->data; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + if ($this->commands !== null && !empty($this->commands)) { |
|
| 31 | + $data['commands'] = $this->commands; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + return $data; |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
| 6 | 6 | |
| 7 | -class ParallelCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 7 | +class ParallelCommand extends AbstractStandardCommand { |
|
| 9 | 8 | public const TYPE = 'Parallel'; |
| 10 | 9 | |
| 11 | 10 | /** |
@@ -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 SetValueCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'SetValue'; |
|
| 7 | + class SetValueCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | + { |
|
| 9 | + public const TYPE = 'SetValue'; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 11 | + /** |
|
| 12 | 12 | * @param string|null $componentId ID of the component to set value on |
| 13 | 13 | * @param string|null $property Property to set |
| 14 | 14 | * @param mixed $value Value to set |
| 15 | 15 | */ |
| 16 | - public function __construct( |
|
| 17 | - public ?string $componentId = null, |
|
| 18 | - public ?string $property = null, |
|
| 19 | - public mixed $value = null, |
|
| 20 | - ) { |
|
| 21 | - parent::__construct(self::TYPE); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - public function jsonSerialize(): array |
|
| 25 | - { |
|
| 26 | - $data = parent::jsonSerialize(); |
|
| 27 | - |
|
| 28 | - if ($this->componentId !== null) { |
|
| 29 | - $data['componentId'] = $this->componentId; |
|
| 16 | + public function __construct( |
|
| 17 | + public ?string $componentId = null, |
|
| 18 | + public ?string $property = null, |
|
| 19 | + public mixed $value = null, |
|
| 20 | + ) { |
|
| 21 | + parent::__construct(self::TYPE); |
|
| 30 | 22 | } |
| 31 | 23 | |
| 32 | - if ($this->property !== null) { |
|
| 33 | - $data['property'] = $this->property; |
|
| 34 | - } |
|
| 24 | + public function jsonSerialize(): array |
|
| 25 | + { |
|
| 26 | + $data = parent::jsonSerialize(); |
|
| 35 | 27 | |
| 36 | - if ($this->value !== null) { |
|
| 37 | - $data['value'] = $this->value; |
|
| 38 | - } |
|
| 28 | + if ($this->componentId !== null) { |
|
| 29 | + $data['componentId'] = $this->componentId; |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + if ($this->property !== null) { |
|
| 33 | + $data['property'] = $this->property; |
|
| 34 | + } |
|
| 39 | 35 | |
| 40 | - return $data; |
|
| 41 | - } |
|
| 36 | + if ($this->value !== null) { |
|
| 37 | + $data['value'] = $this->value; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + return $data; |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -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 IdleCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'Idle'; |
|
| 10 | - |
|
| 11 | - public function __construct() |
|
| 7 | + class IdleCommand extends AbstractStandardCommand |
|
| 12 | 8 | { |
| 13 | - parent::__construct(self::TYPE); |
|
| 14 | - } |
|
| 9 | + public const TYPE = 'Idle'; |
|
| 15 | 10 | |
| 16 | - public function jsonSerialize(): array |
|
| 17 | - { |
|
| 18 | - return parent::jsonSerialize(); |
|
| 19 | - } |
|
| 11 | + public function __construct() |
|
| 12 | + { |
|
| 13 | + parent::__construct(self::TYPE); |
|
| 14 | + } |
|
| 15 | + |
|
| 16 | + public function jsonSerialize(): array |
|
| 17 | + { |
|
| 18 | + return parent::jsonSerialize(); |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -4,12 +4,10 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand; |
| 6 | 6 | |
| 7 | -class IdleCommand extends AbstractStandardCommand |
|
| 8 | -{ |
|
| 7 | +class IdleCommand extends AbstractStandardCommand { |
|
| 9 | 8 | public const TYPE = 'Idle'; |
| 10 | 9 | |
| 11 | - public function __construct() |
|
| 12 | - { |
|
| 10 | + public function __construct() { |
|
| 13 | 11 | parent::__construct(self::TYPE); |
| 14 | 12 | } |
| 15 | 13 | |
@@ -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 SelectCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'Select'; |
|
| 7 | + class SelectCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | + { |
|
| 9 | + public const TYPE = 'Select'; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 11 | + /** |
|
| 12 | 12 | * @param string|null $componentId ID of the component to select |
| 13 | 13 | * @param AbstractStandardCommand[]|null $commands Commands to run when condition is true |
| 14 | 14 | * @param array|null $data Array of data to iterate over |
| 15 | 15 | * @param AbstractStandardCommand[]|null $otherwise Commands to run when condition is false |
| 16 | 16 | */ |
| 17 | - public function __construct( |
|
| 18 | - public ?string $componentId = null, |
|
| 19 | - public ?array $commands = null, |
|
| 20 | - public ?array $data = null, |
|
| 21 | - public ?array $otherwise = 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 ?array $commands = null, |
|
| 20 | + public ?array $data = null, |
|
| 21 | + public ?array $otherwise = null, |
|
| 22 | + ) { |
|
| 23 | + parent::__construct(self::TYPE); |
|
| 32 | 24 | } |
| 33 | 25 | |
| 34 | - if ($this->commands !== null && !empty($this->commands)) { |
|
| 35 | - $data['commands'] = $this->commands; |
|
| 36 | - } |
|
| 26 | + public function jsonSerialize(): array |
|
| 27 | + { |
|
| 28 | + $data = parent::jsonSerialize(); |
|
| 37 | 29 | |
| 38 | - if ($this->data !== null && !empty($this->data)) { |
|
| 39 | - $data['data'] = $this->data; |
|
| 40 | - } |
|
| 30 | + if ($this->componentId !== null) { |
|
| 31 | + $data['componentId'] = $this->componentId; |
|
| 32 | + } |
|
| 41 | 33 | |
| 42 | - if ($this->otherwise !== null && !empty($this->otherwise)) { |
|
| 43 | - $data['otherwise'] = $this->otherwise; |
|
| 44 | - } |
|
| 34 | + if ($this->commands !== null && !empty($this->commands)) { |
|
| 35 | + $data['commands'] = $this->commands; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + if ($this->data !== null && !empty($this->data)) { |
|
| 39 | + $data['data'] = $this->data; |
|
| 40 | + } |
|
| 45 | 41 | |
| 46 | - return $data; |
|
| 47 | - } |
|
| 42 | + if ($this->otherwise !== null && !empty($this->otherwise)) { |
|
| 43 | + $data['otherwise'] = $this->otherwise; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + return $data; |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -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 | -class SequentialCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | -{ |
|
| 9 | - public const TYPE = 'Sequential'; |
|
| 7 | + class SequentialCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 8 | + { |
|
| 9 | + public const TYPE = 'Sequential'; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 11 | + /** |
|
| 12 | 12 | * @param AbstractStandardCommand[]|null $catch Commands to run if an error occurs |
| 13 | 13 | * @param AbstractStandardCommand[]|null $commands Commands to run sequentially |
| 14 | 14 | * @param array|null $data Array of data to iterate over |
| 15 | 15 | * @param int|null $repeatCount Number of times to repeat the sequence |
| 16 | 16 | * @param AbstractStandardCommand[]|null $finally Commands to run after completion |
| 17 | 17 | */ |
| 18 | - public function __construct( |
|
| 19 | - public ?array $catch = null, |
|
| 20 | - public ?array $commands = null, |
|
| 21 | - public ?array $data = null, |
|
| 22 | - public ?int $repeatCount = null, |
|
| 23 | - public ?array $finally = null, |
|
| 24 | - ) { |
|
| 25 | - parent::__construct(self::TYPE); |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function jsonSerialize(): array |
|
| 29 | - { |
|
| 30 | - $data = parent::jsonSerialize(); |
|
| 31 | - |
|
| 32 | - if ($this->catch !== null && !empty($this->catch)) { |
|
| 33 | - $data['catch'] = $this->catch; |
|
| 18 | + public function __construct( |
|
| 19 | + public ?array $catch = null, |
|
| 20 | + public ?array $commands = null, |
|
| 21 | + public ?array $data = null, |
|
| 22 | + public ?int $repeatCount = null, |
|
| 23 | + public ?array $finally = null, |
|
| 24 | + ) { |
|
| 25 | + parent::__construct(self::TYPE); |
|
| 34 | 26 | } |
| 35 | 27 | |
| 36 | - if ($this->commands !== null && !empty($this->commands)) { |
|
| 37 | - $data['commands'] = $this->commands; |
|
| 38 | - } |
|
| 28 | + public function jsonSerialize(): array |
|
| 29 | + { |
|
| 30 | + $data = parent::jsonSerialize(); |
|
| 39 | 31 | |
| 40 | - if ($this->data !== null && !empty($this->data)) { |
|
| 41 | - $data['data'] = $this->data; |
|
| 42 | - } |
|
| 32 | + if ($this->catch !== null && !empty($this->catch)) { |
|
| 33 | + $data['catch'] = $this->catch; |
|
| 34 | + } |
|
| 43 | 35 | |
| 44 | - if ($this->repeatCount !== null) { |
|
| 45 | - $data['repeatCount'] = $this->repeatCount; |
|
| 46 | - } |
|
| 36 | + if ($this->commands !== null && !empty($this->commands)) { |
|
| 37 | + $data['commands'] = $this->commands; |
|
| 38 | + } |
|
| 47 | 39 | |
| 48 | - if ($this->finally !== null && !empty($this->finally)) { |
|
| 49 | - $data['finally'] = $this->finally; |
|
| 50 | - } |
|
| 40 | + if ($this->data !== null && !empty($this->data)) { |
|
| 41 | + $data['data'] = $this->data; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + if ($this->repeatCount !== null) { |
|
| 45 | + $data['repeatCount'] = $this->repeatCount; |
|
| 46 | + } |
|
| 51 | 47 | |
| 52 | - return $data; |
|
| 53 | - } |
|
| 48 | + if ($this->finally !== null && !empty($this->finally)) { |
|
| 49 | + $data['finally'] = $this->finally; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + return $data; |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -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\SetPagePosition; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\SetPagePosition; |
|
| 8 | 8 | |
| 9 | -class SetPageCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - public const TYPE = 'SetPage'; |
|
| 9 | + class SetPageCommand extends AbstractStandardCommand implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + public const TYPE = 'SetPage'; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * @param string|null $componentId ID of the component to set page on |
| 15 | 15 | * @param SetPagePosition $position Position type for the page change |
| 16 | 16 | * @param int|null $transitionDuration Duration of the page transition in milliseconds |
| 17 | 17 | * @param int|null $value Page value to set |
| 18 | 18 | */ |
| 19 | - public function __construct( |
|
| 20 | - public ?string $componentId = null, |
|
| 21 | - public SetPagePosition $position = SetPagePosition::ABSOLUTE, |
|
| 22 | - public ?int $transitionDuration = null, |
|
| 23 | - public ?int $value = 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 SetPagePosition $position = SetPagePosition::ABSOLUTE, |
|
| 22 | + public ?int $transitionDuration = null, |
|
| 23 | + public ?int $value = null, |
|
| 24 | + ) { |
|
| 25 | + parent::__construct(self::TYPE); |
|
| 34 | 26 | } |
| 35 | 27 | |
| 36 | - $data['position'] = $this->position->value; |
|
| 28 | + public function jsonSerialize(): array |
|
| 29 | + { |
|
| 30 | + $data = parent::jsonSerialize(); |
|
| 37 | 31 | |
| 38 | - if ($this->transitionDuration !== null) { |
|
| 39 | - $data['transitionDuration'] = $this->transitionDuration; |
|
| 40 | - } |
|
| 32 | + if ($this->componentId !== null) { |
|
| 33 | + $data['componentId'] = $this->componentId; |
|
| 34 | + } |
|
| 41 | 35 | |
| 42 | - if ($this->value !== null) { |
|
| 43 | - $data['value'] = $this->value; |
|
| 44 | - } |
|
| 36 | + $data['position'] = $this->position->value; |
|
| 37 | + |
|
| 38 | + if ($this->transitionDuration !== null) { |
|
| 39 | + $data['transitionDuration'] = $this->transitionDuration; |
|
| 40 | + } |
|
| 45 | 41 | |
| 46 | - return $data; |
|
| 47 | - } |
|
| 42 | + if ($this->value !== null) { |
|
| 43 | + $data['value'] = $this->value; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + return $data; |
|
| 47 | + } |
|
| 48 | 48 | } |