@@ -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\Document; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Document; |
|
| 6 | 6 | |
| 7 | -enum SubmitKeyType: string |
|
| 8 | -{ |
|
| 9 | - case DONE = 'done'; |
|
| 10 | - case GO = 'go'; |
|
| 11 | - case NEXT = 'next'; |
|
| 12 | - case SEARCH = 'search'; |
|
| 13 | - case SEND = 'send'; |
|
| 7 | + enum SubmitKeyType: string |
|
| 8 | + { |
|
| 9 | + case DONE = 'done'; |
|
| 10 | + case GO = 'go'; |
|
| 11 | + case NEXT = 'next'; |
|
| 12 | + case SEARCH = 'search'; |
|
| 13 | + case SEND = 'send'; |
|
| 14 | 14 | } |
@@ -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\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 APLDocument implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - /** |
|
| 9 | + class APLDocument implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + /** |
|
| 12 | 12 | * @param MainTemplate $mainTemplate The main template that defines the layout to inflate when the document first displays |
| 13 | 13 | * @param string $type The type of the document, must be "APL" |
| 14 | 14 | * @param string $version The APL version this document uses |
@@ -32,45 +32,45 @@ discard block |
||
| 32 | 32 | * @param Style[]|null $styles Array of Style objects for reusable styling |
| 33 | 33 | * @param string|null $theme Theme name to apply to the document |
| 34 | 34 | */ |
| 35 | - public function __construct( |
|
| 36 | - public MainTemplate $mainTemplate, |
|
| 37 | - public string $type = 'APL', |
|
| 38 | - public string $version = '2024.3', |
|
| 39 | - public Gradient|string|null $background = null, |
|
| 40 | - public ?array $commands = null, |
|
| 41 | - public ?string $description = null, |
|
| 42 | - public ?Environment $environment = null, |
|
| 43 | - public ?Export $export = null, |
|
| 44 | - public ?array $extensions = null, |
|
| 45 | - public ?array $graphics = null, |
|
| 46 | - public ?array $handleKeyDown = null, |
|
| 47 | - public ?array $handleKeyUp = null, |
|
| 48 | - public ?array $handleTick = null, |
|
| 49 | - public ?array $import = null, |
|
| 50 | - public array $layouts = [], |
|
| 51 | - public ?AbstractStandardCommand $onConfigChange = null, |
|
| 52 | - public ?array $onDisplayStateChange = null, |
|
| 53 | - public ?AbstractStandardCommand $onMount = null, |
|
| 54 | - public ?array $resources = null, |
|
| 55 | - public ?Settings $settings = null, |
|
| 56 | - public ?array $styles = null, |
|
| 57 | - public ?string $theme = null, |
|
| 58 | - ) { |
|
| 59 | - } |
|
| 35 | + public function __construct( |
|
| 36 | + public MainTemplate $mainTemplate, |
|
| 37 | + public string $type = 'APL', |
|
| 38 | + public string $version = '2024.3', |
|
| 39 | + public Gradient|string|null $background = null, |
|
| 40 | + public ?array $commands = null, |
|
| 41 | + public ?string $description = null, |
|
| 42 | + public ?Environment $environment = null, |
|
| 43 | + public ?Export $export = null, |
|
| 44 | + public ?array $extensions = null, |
|
| 45 | + public ?array $graphics = null, |
|
| 46 | + public ?array $handleKeyDown = null, |
|
| 47 | + public ?array $handleKeyUp = null, |
|
| 48 | + public ?array $handleTick = null, |
|
| 49 | + public ?array $import = null, |
|
| 50 | + public array $layouts = [], |
|
| 51 | + public ?AbstractStandardCommand $onConfigChange = null, |
|
| 52 | + public ?array $onDisplayStateChange = null, |
|
| 53 | + public ?AbstractStandardCommand $onMount = null, |
|
| 54 | + public ?array $resources = null, |
|
| 55 | + public ?Settings $settings = null, |
|
| 56 | + public ?array $styles = null, |
|
| 57 | + public ?string $theme = null, |
|
| 58 | + ) { |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function setLayout(string $name, Layout $layout): void |
|
| 62 | - { |
|
| 63 | - $this->layouts[$name] = $layout; |
|
| 64 | - } |
|
| 61 | + public function setLayout(string $name, Layout $layout): void |
|
| 62 | + { |
|
| 63 | + $this->layouts[$name] = $layout; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function jsonSerialize(): array |
|
| 67 | - { |
|
| 68 | - return array_filter(get_object_vars($this), function ($val) { |
|
| 69 | - if (is_array($val)) { |
|
| 70 | - return count($val) > 0; |
|
| 71 | - } |
|
| 66 | + public function jsonSerialize(): array |
|
| 67 | + { |
|
| 68 | + return array_filter(get_object_vars($this), function ($val) { |
|
| 69 | + if (is_array($val)) { |
|
| 70 | + return count($val) > 0; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - return $val !== null; |
|
| 74 | - }); |
|
| 75 | - } |
|
| 73 | + return $val !== null; |
|
| 74 | + }); |
|
| 75 | + } |
|
| 76 | 76 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public MainTemplate $mainTemplate, |
| 37 | 37 | public string $type = 'APL', |
| 38 | 38 | public string $version = '2024.3', |
| 39 | - public Gradient|string|null $background = null, |
|
| 39 | + public Gradient | string | null $background = null, |
|
| 40 | 40 | public ?array $commands = null, |
| 41 | 41 | public ?string $description = null, |
| 42 | 42 | public ?Environment $environment = null, |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function jsonSerialize(): array |
| 67 | 67 | { |
| 68 | - return array_filter(get_object_vars($this), function ($val) { |
|
| 68 | + return array_filter(get_object_vars($this), function($val) { |
|
| 69 | 69 | if (is_array($val)) { |
| 70 | 70 | return count($val) > 0; |
| 71 | 71 | } |
@@ -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 TransformerType: string |
|
| 8 | -{ |
|
| 9 | - case SSML_TO_SPEECH = 'ssmlToSpeech'; |
|
| 10 | - case TEXT_TO_SPEECH = 'textToSpeech'; |
|
| 11 | - case APL_AUDIO_TO_SPEECH = 'aplAudioToSpeech'; |
|
| 7 | + enum TransformerType: string |
|
| 8 | + { |
|
| 9 | + case SSML_TO_SPEECH = 'ssmlToSpeech'; |
|
| 10 | + case TEXT_TO_SPEECH = 'textToSpeech'; |
|
| 11 | + case APL_AUDIO_TO_SPEECH = 'aplAudioToSpeech'; |
|
| 12 | 12 | } |
@@ -1,39 +1,39 @@ |
||
| 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 Bind implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - /** |
|
| 9 | + class Bind implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + /** |
|
| 12 | 12 | * @param string $name Name of the binding |
| 13 | 13 | * @param mixed $value Value to bind |
| 14 | 14 | * @param BindType $type Type of the binding |
| 15 | 15 | * @param AbstractStandardCommand[] $onChange Commands to run when value changes |
| 16 | 16 | */ |
| 17 | - public function __construct( |
|
| 18 | - public string $name, |
|
| 19 | - public mixed $value, |
|
| 20 | - public BindType $type = BindType::ANY, |
|
| 21 | - public array $onChange = [], |
|
| 22 | - ) { |
|
| 23 | - } |
|
| 17 | + public function __construct( |
|
| 18 | + public string $name, |
|
| 19 | + public mixed $value, |
|
| 20 | + public BindType $type = BindType::ANY, |
|
| 21 | + public array $onChange = [], |
|
| 22 | + ) { |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - public function jsonSerialize(): array |
|
| 26 | - { |
|
| 27 | - $data = [ |
|
| 28 | - 'name' => $this->name, |
|
| 29 | - 'value' => $this->value, |
|
| 30 | - 'type' => $this->type->value, |
|
| 31 | - ]; |
|
| 25 | + public function jsonSerialize(): array |
|
| 26 | + { |
|
| 27 | + $data = [ |
|
| 28 | + 'name' => $this->name, |
|
| 29 | + 'value' => $this->value, |
|
| 30 | + 'type' => $this->type->value, |
|
| 31 | + ]; |
|
| 32 | 32 | |
| 33 | - if (!empty($this->onChange)) { |
|
| 34 | - $data['onChange'] = $this->onChange; |
|
| 35 | - } |
|
| 33 | + if (!empty($this->onChange)) { |
|
| 34 | + $data['onChange'] = $this->onChange; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - return $data; |
|
| 38 | - } |
|
| 37 | + return $data; |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -1,31 +1,31 @@ |
||
| 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 KeyHandler implements \JsonSerializable |
|
| 10 | -{ |
|
| 11 | - /** |
|
| 9 | + class KeyHandler implements \JsonSerializable |
|
| 10 | + { |
|
| 11 | + /** |
|
| 12 | 12 | * @param AbstractStandardCommand[] $commands Commands to run when handler applies |
| 13 | 13 | * @param bool $propagate Whether to propagate the event after handling |
| 14 | 14 | * @param string|null $when APL boolean expression controlling whether this handler is considered |
| 15 | 15 | */ |
| 16 | - public function __construct( |
|
| 17 | - public array $commands = [], |
|
| 18 | - public bool $propagate = false, |
|
| 19 | - public ?string $when = null, |
|
| 20 | - ) { |
|
| 21 | - } |
|
| 16 | + public function __construct( |
|
| 17 | + public array $commands = [], |
|
| 18 | + public bool $propagate = false, |
|
| 19 | + public ?string $when = null, |
|
| 20 | + ) { |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function jsonSerialize(): array |
|
| 24 | - { |
|
| 25 | - return array_filter([ |
|
| 26 | - 'commands' => $this->commands, |
|
| 27 | - 'propagate' => $this->propagate, |
|
| 28 | - 'when' => $this->when, |
|
| 29 | - ], fn ($value) => $value !== null); |
|
| 30 | - } |
|
| 23 | + public function jsonSerialize(): array |
|
| 24 | + { |
|
| 25 | + return array_filter([ |
|
| 26 | + 'commands' => $this->commands, |
|
| 27 | + 'propagate' => $this->propagate, |
|
| 28 | + 'when' => $this->when, |
|
| 29 | + ], fn ($value) => $value !== null); |
|
| 30 | + } |
|
| 31 | 31 | } |
@@ -1,17 +1,17 @@ |
||
| 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 ControlMediaCommand: string |
|
| 8 | -{ |
|
| 9 | - case PLAY = 'play'; |
|
| 10 | - case PAUSE = 'pause'; |
|
| 11 | - case NEXT = 'next'; |
|
| 12 | - case PREVIOUS = 'previous'; |
|
| 13 | - case REWIND = 'rewind'; |
|
| 14 | - case SEEK = 'seek'; |
|
| 15 | - case SEEK_TO = 'seekTo'; |
|
| 16 | - case SET_TRACK = 'setTrack'; |
|
| 7 | + enum ControlMediaCommand: string |
|
| 8 | + { |
|
| 9 | + case PLAY = 'play'; |
|
| 10 | + case PAUSE = 'pause'; |
|
| 11 | + case NEXT = 'next'; |
|
| 12 | + case PREVIOUS = 'previous'; |
|
| 13 | + case REWIND = 'rewind'; |
|
| 14 | + case SEEK = 'seek'; |
|
| 15 | + case SEEK_TO = 'seekTo'; |
|
| 16 | + case SET_TRACK = 'setTrack'; |
|
| 17 | 17 | } |
@@ -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 Navigation: string |
|
| 8 | -{ |
|
| 9 | - case NORMAL = 'normal'; |
|
| 10 | - case NONE = 'none'; |
|
| 11 | - case WRAP = 'wrap'; |
|
| 12 | - case FORWARD_ONLY = 'forward-only'; |
|
| 7 | + enum Navigation: string |
|
| 8 | + { |
|
| 9 | + case NORMAL = 'normal'; |
|
| 10 | + case NONE = 'none'; |
|
| 11 | + case WRAP = 'wrap'; |
|
| 12 | + case FORWARD_ONLY = 'forward-only'; |
|
| 13 | 13 | } |
@@ -1,11 +1,11 @@ |
||
| 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 PageDirection: string |
|
| 8 | -{ |
|
| 9 | - case HORIZONTAL = 'horizontal'; |
|
| 10 | - case VERTICAL = 'vertical'; |
|
| 7 | + enum PageDirection: string |
|
| 8 | + { |
|
| 9 | + case HORIZONTAL = 'horizontal'; |
|
| 10 | + case VERTICAL = 'vertical'; |
|
| 11 | 11 | } |
@@ -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 FlexAlignItems: string |
|
| 8 | -{ |
|
| 9 | - case CENTER = 'center'; |
|
| 10 | - case START = 'start'; |
|
| 11 | - case END = 'end'; |
|
| 7 | + enum FlexAlignItems: string |
|
| 8 | + { |
|
| 9 | + case CENTER = 'center'; |
|
| 10 | + case START = 'start'; |
|
| 11 | + case END = 'end'; |
|
| 12 | 12 | } |