@@ -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\Document; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Document; |
|
| 6 | 6 | |
| 7 | -class Gradient implements \JsonSerializable |
|
| 8 | -{ |
|
| 9 | - /** |
|
| 7 | + class Gradient implements \JsonSerializable |
|
| 8 | + { |
|
| 9 | + /** |
|
| 10 | 10 | * @param string[] $colorRange Array of colors for the gradient |
| 11 | 11 | * @param string $description Description of the gradient |
| 12 | 12 | * @param BackgroundType $type Type of gradient (linear or radial) |
| 13 | 13 | * @param float[]|null $inputRange Array of input range values |
| 14 | 14 | * @param int $angle Angle for linear gradients |
| 15 | 15 | */ |
| 16 | - public function __construct( |
|
| 17 | - public array $colorRange, |
|
| 18 | - public string $description = '', |
|
| 19 | - public BackgroundType $type = BackgroundType::LINEAR, |
|
| 20 | - public ?array $inputRange = [], |
|
| 21 | - public int $angle = 0, |
|
| 22 | - ) { |
|
| 23 | - } |
|
| 16 | + public function __construct( |
|
| 17 | + public array $colorRange, |
|
| 18 | + public string $description = '', |
|
| 19 | + public BackgroundType $type = BackgroundType::LINEAR, |
|
| 20 | + public ?array $inputRange = [], |
|
| 21 | + public int $angle = 0, |
|
| 22 | + ) { |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function jsonSerialize(): array |
|
| 26 | - { |
|
| 27 | - $data = [ |
|
| 28 | - 'description' => $this->description, |
|
| 29 | - 'colorRange' => $this->colorRange, |
|
| 30 | - 'angle' => $this->angle, |
|
| 31 | - 'type' => $this->type, |
|
| 32 | - ]; |
|
| 25 | + public function jsonSerialize(): array |
|
| 26 | + { |
|
| 27 | + $data = [ |
|
| 28 | + 'description' => $this->description, |
|
| 29 | + 'colorRange' => $this->colorRange, |
|
| 30 | + 'angle' => $this->angle, |
|
| 31 | + 'type' => $this->type, |
|
| 32 | + ]; |
|
| 33 | 33 | |
| 34 | - if ($this->inputRange !== null && count($this->inputRange) > 0) { |
|
| 35 | - $data['inputRange'] = $this->inputRange; |
|
| 36 | - } |
|
| 34 | + if ($this->inputRange !== null && count($this->inputRange) > 0) { |
|
| 35 | + $data['inputRange'] = $this->inputRange; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - return $data; |
|
| 39 | - } |
|
| 38 | + return $data; |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -1,51 +1,51 @@ |
||
| 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 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
| 8 | 8 | |
| 9 | -class TickHandler implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - public const DEFAULT_MINIMUM_DELAY = 1000; |
|
| 9 | + class TickHandler implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + public const DEFAULT_MINIMUM_DELAY = 1000; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 13 | + /** |
|
| 14 | 14 | * @param AbstractStandardCommand[] $commands Commands to run during tick events |
| 15 | 15 | * @param string|null $when APL boolean expression controlling whether the handler is active. Null means always active. |
| 16 | 16 | * @param string $description Optional description of this handler |
| 17 | 17 | * @param int $minimumDelay Minimum delay between tick events in milliseconds |
| 18 | 18 | */ |
| 19 | - public function __construct( |
|
| 20 | - public array $commands = [], |
|
| 21 | - public ?string $when = null, |
|
| 22 | - public string $description = '', |
|
| 23 | - public int $minimumDelay = self::DEFAULT_MINIMUM_DELAY, |
|
| 24 | - ) { |
|
| 25 | - // Filter and ensure valid commands |
|
| 26 | - $this->commands = array_values(array_filter( |
|
| 27 | - $this->commands, |
|
| 28 | - static fn ($c) => $c instanceof AbstractStandardCommand |
|
| 29 | - )); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - public function jsonSerialize(): array |
|
| 33 | - { |
|
| 34 | - $data = []; |
|
| 35 | - |
|
| 36 | - if ($this->commands !== []) { |
|
| 37 | - $data['commands'] = $this->commands; |
|
| 38 | - } |
|
| 39 | - if ($this->description !== '') { |
|
| 40 | - $data['description'] = $this->description; |
|
| 41 | - } |
|
| 42 | - if ($this->minimumDelay !== self::DEFAULT_MINIMUM_DELAY) { |
|
| 43 | - $data['minimumDelay'] = $this->minimumDelay; |
|
| 44 | - } |
|
| 45 | - if ($this->when !== null && $this->when !== '') { |
|
| 46 | - $data['when'] = $this->when; |
|
| 19 | + public function __construct( |
|
| 20 | + public array $commands = [], |
|
| 21 | + public ?string $when = null, |
|
| 22 | + public string $description = '', |
|
| 23 | + public int $minimumDelay = self::DEFAULT_MINIMUM_DELAY, |
|
| 24 | + ) { |
|
| 25 | + // Filter and ensure valid commands |
|
| 26 | + $this->commands = array_values(array_filter( |
|
| 27 | + $this->commands, |
|
| 28 | + static fn ($c) => $c instanceof AbstractStandardCommand |
|
| 29 | + )); |
|
| 47 | 30 | } |
| 48 | 31 | |
| 49 | - return $data; |
|
| 50 | - } |
|
| 32 | + public function jsonSerialize(): array |
|
| 33 | + { |
|
| 34 | + $data = []; |
|
| 35 | + |
|
| 36 | + if ($this->commands !== []) { |
|
| 37 | + $data['commands'] = $this->commands; |
|
| 38 | + } |
|
| 39 | + if ($this->description !== '') { |
|
| 40 | + $data['description'] = $this->description; |
|
| 41 | + } |
|
| 42 | + if ($this->minimumDelay !== self::DEFAULT_MINIMUM_DELAY) { |
|
| 43 | + $data['minimumDelay'] = $this->minimumDelay; |
|
| 44 | + } |
|
| 45 | + if ($this->when !== null && $this->when !== '') { |
|
| 46 | + $data['when'] = $this->when; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + return $data; |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -1,47 +1,47 @@ |
||
| 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 | -use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\AbstractStandardCommand; |
|
| 8 | 8 | |
| 9 | -class Command implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - /** |
|
| 9 | + class Command implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + /** |
|
| 12 | 12 | * @param Parameter[]|null $parameters Array of parameter definitions |
| 13 | 13 | * @param AbstractStandardCommand|null $command Single command to run |
| 14 | 14 | * @param AbstractStandardCommand[]|null $commands Array of commands to run |
| 15 | 15 | * @param string|null $description Description of this command |
| 16 | 16 | */ |
| 17 | - public function __construct( |
|
| 18 | - public ?array $parameters = null, |
|
| 19 | - public ?AbstractStandardCommand $command = null, |
|
| 20 | - public ?array $commands = null, |
|
| 21 | - public ?string $description = null, |
|
| 22 | - ) { |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - public function jsonSerialize(): array |
|
| 26 | - { |
|
| 27 | - $data = []; |
|
| 28 | - |
|
| 29 | - if ($this->parameters !== null) { |
|
| 30 | - $data['parameters'] = $this->parameters; |
|
| 17 | + public function __construct( |
|
| 18 | + public ?array $parameters = null, |
|
| 19 | + public ?AbstractStandardCommand $command = null, |
|
| 20 | + public ?array $commands = null, |
|
| 21 | + public ?string $description = null, |
|
| 22 | + ) { |
|
| 31 | 23 | } |
| 32 | 24 | |
| 33 | - if ($this->command !== null) { |
|
| 34 | - $data['command'] = $this->command; |
|
| 35 | - } |
|
| 25 | + public function jsonSerialize(): array |
|
| 26 | + { |
|
| 27 | + $data = []; |
|
| 36 | 28 | |
| 37 | - if ($this->commands !== null) { |
|
| 38 | - $data['commands'] = $this->commands; |
|
| 39 | - } |
|
| 29 | + if ($this->parameters !== null) { |
|
| 30 | + $data['parameters'] = $this->parameters; |
|
| 31 | + } |
|
| 40 | 32 | |
| 41 | - if ($this->description !== null) { |
|
| 42 | - $data['description'] = $this->description; |
|
| 43 | - } |
|
| 33 | + if ($this->command !== null) { |
|
| 34 | + $data['command'] = $this->command; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + if ($this->commands !== null) { |
|
| 38 | + $data['commands'] = $this->commands; |
|
| 39 | + } |
|
| 44 | 40 | |
| 45 | - return $data; |
|
| 46 | - } |
|
| 41 | + if ($this->description !== null) { |
|
| 42 | + $data['description'] = $this->description; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + return $data; |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -1,15 +1,15 @@ |
||
| 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 KeyboardType: string |
|
| 8 | -{ |
|
| 9 | - case DECIMAL_PAD = 'decimalPad'; |
|
| 10 | - case NORMAL = 'normal'; |
|
| 11 | - case NUMBER_PAD = 'numberPad'; |
|
| 12 | - case EMAIL_ADDRESS = 'emailAddress'; |
|
| 13 | - case PHONE_PAD = 'phonePad'; |
|
| 14 | - case URL = 'url'; |
|
| 7 | + enum KeyboardType: string |
|
| 8 | + { |
|
| 9 | + case DECIMAL_PAD = 'decimalPad'; |
|
| 10 | + case NORMAL = 'normal'; |
|
| 11 | + case NUMBER_PAD = 'numberPad'; |
|
| 12 | + case EMAIL_ADDRESS = 'emailAddress'; |
|
| 13 | + case PHONE_PAD = 'phonePad'; |
|
| 14 | + case URL = 'url'; |
|
| 15 | 15 | } |
@@ -1,37 +1,37 @@ |
||
| 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 | -class Parameter implements \JsonSerializable |
|
| 8 | -{ |
|
| 9 | - public function __construct( |
|
| 10 | - public string $name, |
|
| 11 | - public mixed $default = null, |
|
| 12 | - public ?string $description = null, |
|
| 13 | - public ?ParameterType $type = null, |
|
| 14 | - ) { |
|
| 15 | - } |
|
| 16 | - |
|
| 17 | - public function jsonSerialize(): array |
|
| 7 | + class Parameter implements \JsonSerializable |
|
| 18 | 8 | { |
| 19 | - $data = [ |
|
| 20 | - 'name' => $this->name, |
|
| 21 | - ]; |
|
| 22 | - |
|
| 23 | - if ($this->type !== null) { |
|
| 24 | - $data['type'] = $this->type; |
|
| 9 | + public function __construct( |
|
| 10 | + public string $name, |
|
| 11 | + public mixed $default = null, |
|
| 12 | + public ?string $description = null, |
|
| 13 | + public ?ParameterType $type = null, |
|
| 14 | + ) { |
|
| 25 | 15 | } |
| 26 | 16 | |
| 27 | - if ($this->default !== null) { |
|
| 28 | - $data['default'] = $this->default; |
|
| 29 | - } |
|
| 17 | + public function jsonSerialize(): array |
|
| 18 | + { |
|
| 19 | + $data = [ |
|
| 20 | + 'name' => $this->name, |
|
| 21 | + ]; |
|
| 30 | 22 | |
| 31 | - if ($this->description !== null) { |
|
| 32 | - $data['description'] = $this->description; |
|
| 33 | - } |
|
| 23 | + if ($this->type !== null) { |
|
| 24 | + $data['type'] = $this->type; |
|
| 25 | + } |
|
| 34 | 26 | |
| 35 | - return $data; |
|
| 36 | - } |
|
| 27 | + if ($this->default !== null) { |
|
| 28 | + $data['default'] = $this->default; |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + if ($this->description !== null) { |
|
| 32 | + $data['description'] = $this->description; |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + return $data; |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -1,12 +1,12 @@ |
||
| 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 StrokeLineCap: string |
|
| 8 | -{ |
|
| 9 | - case BUTT = 'butt'; |
|
| 10 | - case ROUND = 'round'; |
|
| 11 | - case SQUARE = 'square'; |
|
| 7 | + enum StrokeLineCap: string |
|
| 8 | + { |
|
| 9 | + case BUTT = 'butt'; |
|
| 10 | + case ROUND = 'round'; |
|
| 11 | + case SQUARE = 'square'; |
|
| 12 | 12 | } |
@@ -1,12 +1,12 @@ |
||
| 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 StrokeLineJoin: string |
|
| 8 | -{ |
|
| 9 | - case BEVEL = 'bevel'; |
|
| 10 | - case MITER = 'miter'; |
|
| 11 | - case ROUND = 'round'; |
|
| 7 | + enum StrokeLineJoin: string |
|
| 8 | + { |
|
| 9 | + case BEVEL = 'bevel'; |
|
| 10 | + case MITER = 'miter'; |
|
| 11 | + case ROUND = 'round'; |
|
| 12 | 12 | } |
@@ -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 | -class ExportItem implements \JsonSerializable |
|
| 8 | -{ |
|
| 9 | - public function __construct( |
|
| 10 | - public string $name, |
|
| 11 | - public string $description = '', |
|
| 12 | - ) { |
|
| 13 | - } |
|
| 14 | - |
|
| 15 | - public function jsonSerialize(): array |
|
| 7 | + class ExportItem implements \JsonSerializable |
|
| 16 | 8 | { |
| 17 | - return array_filter([ |
|
| 18 | - 'name' => $this->name, |
|
| 19 | - 'description' => $this->description ?: null, |
|
| 20 | - ]); |
|
| 21 | - } |
|
| 9 | + public function __construct( |
|
| 10 | + public string $name, |
|
| 11 | + public string $description = '', |
|
| 12 | + ) { |
|
| 13 | + } |
|
| 14 | + |
|
| 15 | + public function jsonSerialize(): array |
|
| 16 | + { |
|
| 17 | + return array_filter([ |
|
| 18 | + 'name' => $this->name, |
|
| 19 | + 'description' => $this->description ?: null, |
|
| 20 | + ]); |
|
| 21 | + } |
|
| 22 | 22 | } |