@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace MaxBeckers\AmazonAlexa\Request\Request\GameEngine\Event; |
| 6 | 6 | |
| 7 | -class InputEvent |
|
| 8 | -{ |
|
| 7 | +class InputEvent { |
|
| 9 | 8 | public const ACTION_DOWN = 'down'; |
| 10 | 9 | public const ACTION_UP = 'up'; |
| 11 | 10 | |
@@ -1,38 +1,38 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | + declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | -namespace MaxBeckers\AmazonAlexa\Request\Request\GameEngine\Event; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Request\Request\GameEngine\Event; |
|
| 6 | 6 | |
| 7 | -class InputEvent |
|
| 8 | -{ |
|
| 9 | - public const ACTION_DOWN = 'down'; |
|
| 10 | - public const ACTION_UP = 'up'; |
|
| 7 | + class InputEvent |
|
| 8 | + { |
|
| 9 | + public const ACTION_DOWN = 'down'; |
|
| 10 | + public const ACTION_UP = 'up'; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 12 | + /** |
|
| 13 | 13 | * @param string $gadgetId Gadget identifier |
| 14 | 14 | * @param \DateTime $timestamp Event timestamp |
| 15 | 15 | * @param string $action Action type (down/up) |
| 16 | 16 | * @param string $color Color of the input |
| 17 | 17 | * @param string $feature Feature that triggered the event |
| 18 | 18 | */ |
| 19 | - public function __construct( |
|
| 20 | - public string $gadgetId, |
|
| 21 | - public \DateTime $timestamp, |
|
| 22 | - public string $action, |
|
| 23 | - public string $color, |
|
| 24 | - public string $feature, |
|
| 25 | - ) { |
|
| 26 | - } |
|
| 19 | + public function __construct( |
|
| 20 | + public string $gadgetId, |
|
| 21 | + public \DateTime $timestamp, |
|
| 22 | + public string $action, |
|
| 23 | + public string $color, |
|
| 24 | + public string $feature, |
|
| 25 | + ) { |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public static function fromAmazonRequest(array $amazonRequest): self |
|
| 29 | - { |
|
| 30 | - return new self( |
|
| 31 | - gadgetId: $amazonRequest['gadgetId'], |
|
| 32 | - timestamp: new \DateTime($amazonRequest['timestamp']), |
|
| 33 | - action: $amazonRequest['action'], |
|
| 34 | - color: $amazonRequest['color'], |
|
| 35 | - feature: $amazonRequest['feature'], |
|
| 36 | - ); |
|
| 37 | - } |
|
| 28 | + public static function fromAmazonRequest(array $amazonRequest): self |
|
| 29 | + { |
|
| 30 | + return new self( |
|
| 31 | + gadgetId: $amazonRequest['gadgetId'], |
|
| 32 | + timestamp: new \DateTime($amazonRequest['timestamp']), |
|
| 33 | + action: $amazonRequest['action'], |
|
| 34 | + color: $amazonRequest['color'], |
|
| 35 | + feature: $amazonRequest['feature'], |
|
| 36 | + ); |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | use MaxBeckers\AmazonAlexa\Intent\Intent; |
| 9 | 9 | use MaxBeckers\AmazonAlexa\Request\Request\AbstractRequest; |
| 10 | 10 | |
| 11 | -class IntentRequest extends StandardRequest |
|
| 12 | -{ |
|
| 11 | +class IntentRequest extends StandardRequest { |
|
| 13 | 12 | public const DIALOG_STATE_STARTED = 'STARTED'; |
| 14 | 13 | public const DIALOG_STATE_IN_PROGRESS = 'IN_PROGRESS'; |
| 15 | 14 | public const DIALOG_STATE_COMPLETED = 'COMPLETED'; |
@@ -1,22 +1,22 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | + declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | -namespace MaxBeckers\AmazonAlexa\Request\Request\Standard; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Request\Request\Standard; |
|
| 6 | 6 | |
| 7 | -use MaxBeckers\AmazonAlexa\Helper\PropertyHelper; |
|
| 8 | -use MaxBeckers\AmazonAlexa\Intent\Intent; |
|
| 9 | -use MaxBeckers\AmazonAlexa\Request\Request\AbstractRequest; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Helper\PropertyHelper; |
|
| 8 | + use MaxBeckers\AmazonAlexa\Intent\Intent; |
|
| 9 | + use MaxBeckers\AmazonAlexa\Request\Request\AbstractRequest; |
|
| 10 | 10 | |
| 11 | -class IntentRequest extends StandardRequest |
|
| 12 | -{ |
|
| 13 | - public const DIALOG_STATE_STARTED = 'STARTED'; |
|
| 14 | - public const DIALOG_STATE_IN_PROGRESS = 'IN_PROGRESS'; |
|
| 15 | - public const DIALOG_STATE_COMPLETED = 'COMPLETED'; |
|
| 11 | + class IntentRequest extends StandardRequest |
|
| 12 | + { |
|
| 13 | + public const DIALOG_STATE_STARTED = 'STARTED'; |
|
| 14 | + public const DIALOG_STATE_IN_PROGRESS = 'IN_PROGRESS'; |
|
| 15 | + public const DIALOG_STATE_COMPLETED = 'COMPLETED'; |
|
| 16 | 16 | |
| 17 | - public const TYPE = 'IntentRequest'; |
|
| 17 | + public const TYPE = 'IntentRequest'; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 19 | + /** |
|
| 20 | 20 | * @param \DateTime|null $timestamp Request timestamp |
| 21 | 21 | * @param string|null $token Request token |
| 22 | 22 | * @param string|null $requestId Request identifier |
@@ -24,31 +24,31 @@ discard block |
||
| 24 | 24 | * @param string|null $dialogState Current dialog state |
| 25 | 25 | * @param Intent|null $intent Intent information |
| 26 | 26 | */ |
| 27 | - public function __construct( |
|
| 28 | - ?\DateTime $timestamp = null, |
|
| 29 | - ?string $token = null, |
|
| 30 | - ?string $requestId = null, |
|
| 31 | - ?string $locale = null, |
|
| 32 | - public ?string $dialogState = null, |
|
| 33 | - public ?Intent $intent = null, |
|
| 34 | - ) { |
|
| 35 | - parent::__construct( |
|
| 36 | - type: static::TYPE, |
|
| 37 | - timestamp: $timestamp, |
|
| 38 | - token: $token, |
|
| 39 | - requestId: $requestId, |
|
| 40 | - locale: $locale |
|
| 41 | - ); |
|
| 42 | - } |
|
| 27 | + public function __construct( |
|
| 28 | + ?\DateTime $timestamp = null, |
|
| 29 | + ?string $token = null, |
|
| 30 | + ?string $requestId = null, |
|
| 31 | + ?string $locale = null, |
|
| 32 | + public ?string $dialogState = null, |
|
| 33 | + public ?Intent $intent = null, |
|
| 34 | + ) { |
|
| 35 | + parent::__construct( |
|
| 36 | + type: static::TYPE, |
|
| 37 | + timestamp: $timestamp, |
|
| 38 | + token: $token, |
|
| 39 | + requestId: $requestId, |
|
| 40 | + locale: $locale |
|
| 41 | + ); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - public static function fromAmazonRequest(array $amazonRequest): AbstractRequest |
|
| 45 | - { |
|
| 46 | - return new static( |
|
| 47 | - timestamp: self::getTime(PropertyHelper::checkNullValueStringOrInt($amazonRequest, 'timestamp')), |
|
| 48 | - requestId: PropertyHelper::checkNullValueString($amazonRequest, 'requestId'), |
|
| 49 | - locale: PropertyHelper::checkNullValueString($amazonRequest, 'locale'), |
|
| 50 | - dialogState: PropertyHelper::checkNullValueString($amazonRequest, 'dialogState'), |
|
| 51 | - intent: Intent::fromAmazonRequest($amazonRequest['intent']), |
|
| 52 | - ); |
|
| 53 | - } |
|
| 44 | + public static function fromAmazonRequest(array $amazonRequest): AbstractRequest |
|
| 45 | + { |
|
| 46 | + return new static( |
|
| 47 | + timestamp: self::getTime(PropertyHelper::checkNullValueStringOrInt($amazonRequest, 'timestamp')), |
|
| 48 | + requestId: PropertyHelper::checkNullValueString($amazonRequest, 'requestId'), |
|
| 49 | + locale: PropertyHelper::checkNullValueString($amazonRequest, 'locale'), |
|
| 50 | + dialogState: PropertyHelper::checkNullValueString($amazonRequest, 'dialogState'), |
|
| 51 | + intent: Intent::fromAmazonRequest($amazonRequest['intent']), |
|
| 52 | + ); |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -33,11 +33,11 @@ |
||
| 33 | 33 | public ?Intent $intent = null, |
| 34 | 34 | ) { |
| 35 | 35 | parent::__construct( |
| 36 | - type: static::TYPE, |
|
| 37 | - timestamp: $timestamp, |
|
| 38 | - token: $token, |
|
| 39 | - requestId: $requestId, |
|
| 40 | - locale: $locale |
|
| 36 | + type : static::TYPE, |
|
| 37 | + timestamp : $timestamp, |
|
| 38 | + token : $token, |
|
| 39 | + requestId : $requestId, |
|
| 40 | + locale : $locale |
|
| 41 | 41 | ); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace MaxBeckers\AmazonAlexa\Request\Request; |
| 6 | 6 | |
| 7 | -class Error |
|
| 8 | -{ |
|
| 7 | +class Error { |
|
| 9 | 8 | public const TYPE_INVALID_RESPONSE = 'INVALID_RESPONSE'; |
| 10 | 9 | public const TYPE_DEVICE_COMMUNICATION_ERROR = 'DEVICE_COMMUNICATION_ERROR'; |
| 11 | 10 | public const TYPE_INTERNAL_ERROR = 'INTERNAL_ERROR'; |
@@ -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\Request\Request; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Request\Request; |
|
| 6 | 6 | |
| 7 | -class Error |
|
| 8 | -{ |
|
| 9 | - public const TYPE_INVALID_RESPONSE = 'INVALID_RESPONSE'; |
|
| 10 | - public const TYPE_DEVICE_COMMUNICATION_ERROR = 'DEVICE_COMMUNICATION_ERROR'; |
|
| 11 | - public const TYPE_INTERNAL_ERROR = 'INTERNAL_ERROR'; |
|
| 12 | - public const TYPE_MEDIA_ERROR_UNKNOWN = 'MEDIA_ERROR_UNKNOWN'; |
|
| 13 | - public const TYPE_MEDIA_ERROR_INVALID_REQUEST = 'MEDIA_ERROR_INVALID_REQUEST'; |
|
| 14 | - public const TYPE_MEDIA_ERROR_SERVICE_UNAVAILABLE = 'MEDIA_ERROR_SERVICE_UNAVAILABLE'; |
|
| 15 | - public const TYPE_MEDIA_ERROR_INTERNAL_SERVER_ERROR = 'MEDIA_ERROR_INTERNAL_SERVER_ERROR'; |
|
| 16 | - public const TYPE_MEDIA_ERROR_INTERNAL_DEVICE_ERROR = 'MEDIA_ERROR_INTERNAL_DEVICE_ERROR'; |
|
| 7 | + class Error |
|
| 8 | + { |
|
| 9 | + public const TYPE_INVALID_RESPONSE = 'INVALID_RESPONSE'; |
|
| 10 | + public const TYPE_DEVICE_COMMUNICATION_ERROR = 'DEVICE_COMMUNICATION_ERROR'; |
|
| 11 | + public const TYPE_INTERNAL_ERROR = 'INTERNAL_ERROR'; |
|
| 12 | + public const TYPE_MEDIA_ERROR_UNKNOWN = 'MEDIA_ERROR_UNKNOWN'; |
|
| 13 | + public const TYPE_MEDIA_ERROR_INVALID_REQUEST = 'MEDIA_ERROR_INVALID_REQUEST'; |
|
| 14 | + public const TYPE_MEDIA_ERROR_SERVICE_UNAVAILABLE = 'MEDIA_ERROR_SERVICE_UNAVAILABLE'; |
|
| 15 | + public const TYPE_MEDIA_ERROR_INTERNAL_SERVER_ERROR = 'MEDIA_ERROR_INTERNAL_SERVER_ERROR'; |
|
| 16 | + public const TYPE_MEDIA_ERROR_INTERNAL_DEVICE_ERROR = 'MEDIA_ERROR_INTERNAL_DEVICE_ERROR'; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * @param string $type Error type |
| 20 | 20 | * @param string $message Error message |
| 21 | 21 | */ |
| 22 | - public function __construct( |
|
| 23 | - public string $type, |
|
| 24 | - public string $message, |
|
| 25 | - ) { |
|
| 26 | - } |
|
| 22 | + public function __construct( |
|
| 23 | + public string $type, |
|
| 24 | + public string $message, |
|
| 25 | + ) { |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public static function fromAmazonRequest(array $amazonRequest): self |
|
| 29 | - { |
|
| 30 | - return new self( |
|
| 31 | - type: $amazonRequest['type'], |
|
| 32 | - message: $amazonRequest['message'], |
|
| 33 | - ); |
|
| 34 | - } |
|
| 28 | + public static function fromAmazonRequest(array $amazonRequest): self |
|
| 29 | + { |
|
| 30 | + return new self( |
|
| 31 | + type: $amazonRequest['type'], |
|
| 32 | + message: $amazonRequest['message'], |
|
| 33 | + ); |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | |
| 7 | 7 | use MaxBeckers\AmazonAlexa\Request\Request\Standard\IntentRequest; |
| 8 | 8 | |
| 9 | -class CanFulfillIntentRequest extends IntentRequest |
|
| 10 | -{ |
|
| 9 | +class CanFulfillIntentRequest extends IntentRequest { |
|
| 11 | 10 | public const TYPE = 'CanFulfillIntentRequest'; |
| 12 | 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\Request\Request\CanFulfill; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Request\Request\CanFulfill; |
|
| 6 | 6 | |
| 7 | -use MaxBeckers\AmazonAlexa\Request\Request\Standard\IntentRequest; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Request\Request\Standard\IntentRequest; |
|
| 8 | 8 | |
| 9 | -class CanFulfillIntentRequest extends IntentRequest |
|
| 10 | -{ |
|
| 11 | - public const TYPE = 'CanFulfillIntentRequest'; |
|
| 9 | + class CanFulfillIntentRequest extends IntentRequest |
|
| 10 | + { |
|
| 11 | + public const TYPE = 'CanFulfillIntentRequest'; |
|
| 12 | 12 | } |
@@ -31,8 +31,7 @@ |
||
| 31 | 31 | use MaxBeckers\AmazonAlexa\Request\Request\System\ConnectionsResponseRequest; |
| 32 | 32 | use MaxBeckers\AmazonAlexa\Request\Request\System\ExceptionEncounteredRequest; |
| 33 | 33 | |
| 34 | -class Request |
|
| 35 | -{ |
|
| 34 | +class Request { |
|
| 36 | 35 | /** |
| 37 | 36 | * List of all supported amazon request types. |
| 38 | 37 | */ |
@@ -1,85 +1,85 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | + declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | -namespace MaxBeckers\AmazonAlexa\Request; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Request; |
|
| 6 | 6 | |
| 7 | -use MaxBeckers\AmazonAlexa\Exception\MissingRequestDataException; |
|
| 8 | -use MaxBeckers\AmazonAlexa\Exception\MissingRequiredHeaderException; |
|
| 9 | -use MaxBeckers\AmazonAlexa\Helper\PropertyHelper; |
|
| 10 | -use MaxBeckers\AmazonAlexa\Request\Request\AbstractRequest; |
|
| 11 | -use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillAccountLinkedRequest; |
|
| 12 | -use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillDisabledRequest; |
|
| 13 | -use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillEnabledRequest; |
|
| 14 | -use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillPermissionAcceptedRequest; |
|
| 15 | -use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillPermissionChangedRequest; |
|
| 16 | -use MaxBeckers\AmazonAlexa\Request\Request\APL\LoadIndexListDataRequest; |
|
| 17 | -use MaxBeckers\AmazonAlexa\Request\Request\APL\LoadTokenListDataRequest; |
|
| 18 | -use MaxBeckers\AmazonAlexa\Request\Request\APL\RuntimeErrorRequest; |
|
| 19 | -use MaxBeckers\AmazonAlexa\Request\Request\APL\UserEventRequest; |
|
| 20 | -use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackFailedRequest; |
|
| 21 | -use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackFinishedRequest; |
|
| 22 | -use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackNearlyFinishedRequest; |
|
| 23 | -use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackStartedRequest; |
|
| 24 | -use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackStoppedRequest; |
|
| 25 | -use MaxBeckers\AmazonAlexa\Request\Request\CanFulfill\CanFulfillIntentRequest; |
|
| 26 | -use MaxBeckers\AmazonAlexa\Request\Request\Display\ElementSelectedRequest; |
|
| 27 | -use MaxBeckers\AmazonAlexa\Request\Request\GameEngine\InputHandlerEvent; |
|
| 28 | -use MaxBeckers\AmazonAlexa\Request\Request\PlaybackController\NextCommandIssued; |
|
| 29 | -use MaxBeckers\AmazonAlexa\Request\Request\PlaybackController\PauseCommandIssued; |
|
| 30 | -use MaxBeckers\AmazonAlexa\Request\Request\PlaybackController\PlayCommandIssued; |
|
| 31 | -use MaxBeckers\AmazonAlexa\Request\Request\PlaybackController\PreviousCommandIssued; |
|
| 32 | -use MaxBeckers\AmazonAlexa\Request\Request\Standard\IntentRequest; |
|
| 33 | -use MaxBeckers\AmazonAlexa\Request\Request\Standard\LaunchRequest; |
|
| 34 | -use MaxBeckers\AmazonAlexa\Request\Request\Standard\SessionEndedRequest; |
|
| 35 | -use MaxBeckers\AmazonAlexa\Request\Request\System\ConnectionsResponseRequest; |
|
| 36 | -use MaxBeckers\AmazonAlexa\Request\Request\System\ExceptionEncounteredRequest; |
|
| 7 | + use MaxBeckers\AmazonAlexa\Exception\MissingRequestDataException; |
|
| 8 | + use MaxBeckers\AmazonAlexa\Exception\MissingRequiredHeaderException; |
|
| 9 | + use MaxBeckers\AmazonAlexa\Helper\PropertyHelper; |
|
| 10 | + use MaxBeckers\AmazonAlexa\Request\Request\AbstractRequest; |
|
| 11 | + use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillAccountLinkedRequest; |
|
| 12 | + use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillDisabledRequest; |
|
| 13 | + use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillEnabledRequest; |
|
| 14 | + use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillPermissionAcceptedRequest; |
|
| 15 | + use MaxBeckers\AmazonAlexa\Request\Request\AlexaSkillEvent\SkillPermissionChangedRequest; |
|
| 16 | + use MaxBeckers\AmazonAlexa\Request\Request\APL\LoadIndexListDataRequest; |
|
| 17 | + use MaxBeckers\AmazonAlexa\Request\Request\APL\LoadTokenListDataRequest; |
|
| 18 | + use MaxBeckers\AmazonAlexa\Request\Request\APL\RuntimeErrorRequest; |
|
| 19 | + use MaxBeckers\AmazonAlexa\Request\Request\APL\UserEventRequest; |
|
| 20 | + use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackFailedRequest; |
|
| 21 | + use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackFinishedRequest; |
|
| 22 | + use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackNearlyFinishedRequest; |
|
| 23 | + use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackStartedRequest; |
|
| 24 | + use MaxBeckers\AmazonAlexa\Request\Request\AudioPlayer\PlaybackStoppedRequest; |
|
| 25 | + use MaxBeckers\AmazonAlexa\Request\Request\CanFulfill\CanFulfillIntentRequest; |
|
| 26 | + use MaxBeckers\AmazonAlexa\Request\Request\Display\ElementSelectedRequest; |
|
| 27 | + use MaxBeckers\AmazonAlexa\Request\Request\GameEngine\InputHandlerEvent; |
|
| 28 | + use MaxBeckers\AmazonAlexa\Request\Request\PlaybackController\NextCommandIssued; |
|
| 29 | + use MaxBeckers\AmazonAlexa\Request\Request\PlaybackController\PauseCommandIssued; |
|
| 30 | + use MaxBeckers\AmazonAlexa\Request\Request\PlaybackController\PlayCommandIssued; |
|
| 31 | + use MaxBeckers\AmazonAlexa\Request\Request\PlaybackController\PreviousCommandIssued; |
|
| 32 | + use MaxBeckers\AmazonAlexa\Request\Request\Standard\IntentRequest; |
|
| 33 | + use MaxBeckers\AmazonAlexa\Request\Request\Standard\LaunchRequest; |
|
| 34 | + use MaxBeckers\AmazonAlexa\Request\Request\Standard\SessionEndedRequest; |
|
| 35 | + use MaxBeckers\AmazonAlexa\Request\Request\System\ConnectionsResponseRequest; |
|
| 36 | + use MaxBeckers\AmazonAlexa\Request\Request\System\ExceptionEncounteredRequest; |
|
| 37 | 37 | |
| 38 | -class Request |
|
| 39 | -{ |
|
| 40 | - /** |
|
| 38 | + class Request |
|
| 39 | + { |
|
| 40 | + /** |
|
| 41 | 41 | * List of all supported amazon request types. |
| 42 | 42 | */ |
| 43 | - public const REQUEST_TYPES = [ |
|
| 44 | - // Standard types |
|
| 45 | - IntentRequest::TYPE => IntentRequest::class, |
|
| 46 | - LaunchRequest::TYPE => LaunchRequest::class, |
|
| 47 | - SessionEndedRequest::TYPE => SessionEndedRequest::class, |
|
| 48 | - // AudioPlayer types |
|
| 49 | - PlaybackStartedRequest::TYPE => PlaybackStartedRequest::class, |
|
| 50 | - PlaybackNearlyFinishedRequest::TYPE => PlaybackNearlyFinishedRequest::class, |
|
| 51 | - PlaybackFinishedRequest::TYPE => PlaybackFinishedRequest::class, |
|
| 52 | - PlaybackStoppedRequest::TYPE => PlaybackStoppedRequest::class, |
|
| 53 | - PlaybackFailedRequest::TYPE => PlaybackFailedRequest::class, |
|
| 54 | - // PlaybackController types |
|
| 55 | - NextCommandIssued::TYPE => NextCommandIssued::class, |
|
| 56 | - PauseCommandIssued::TYPE => PauseCommandIssued::class, |
|
| 57 | - PlayCommandIssued::TYPE => PlayCommandIssued::class, |
|
| 58 | - PreviousCommandIssued::TYPE => PreviousCommandIssued::class, |
|
| 59 | - // System types |
|
| 60 | - ExceptionEncounteredRequest::TYPE => ExceptionEncounteredRequest::class, |
|
| 61 | - // Display types |
|
| 62 | - ElementSelectedRequest::TYPE => ElementSelectedRequest::class, |
|
| 63 | - // Game engine types |
|
| 64 | - InputHandlerEvent::TYPE => InputHandlerEvent::class, |
|
| 65 | - // can fulfill intent |
|
| 66 | - CanFulfillIntentRequest::TYPE => CanFulfillIntentRequest::class, |
|
| 67 | - // Connections Response Request |
|
| 68 | - ConnectionsResponseRequest::TYPE => ConnectionsResponseRequest::class, |
|
| 69 | - // Skill event types |
|
| 70 | - SkillAccountLinkedRequest::TYPE => SkillAccountLinkedRequest::class, |
|
| 71 | - SkillEnabledRequest::TYPE => SkillEnabledRequest::class, |
|
| 72 | - SkillDisabledRequest::TYPE => SkillDisabledRequest::class, |
|
| 73 | - SkillPermissionAcceptedRequest::TYPE => SkillPermissionAcceptedRequest::class, |
|
| 74 | - SkillPermissionChangedRequest::TYPE => SkillPermissionChangedRequest::class, |
|
| 75 | - // APL request types |
|
| 76 | - LoadIndexListDataRequest::TYPE => LoadIndexListDataRequest::class, |
|
| 77 | - LoadTokenListDataRequest::TYPE => LoadTokenListDataRequest::class, |
|
| 78 | - RuntimeErrorRequest::TYPE => RuntimeErrorRequest::class, |
|
| 79 | - UserEventRequest::TYPE => UserEventRequest::class, |
|
| 80 | - ]; |
|
| 43 | + public const REQUEST_TYPES = [ |
|
| 44 | + // Standard types |
|
| 45 | + IntentRequest::TYPE => IntentRequest::class, |
|
| 46 | + LaunchRequest::TYPE => LaunchRequest::class, |
|
| 47 | + SessionEndedRequest::TYPE => SessionEndedRequest::class, |
|
| 48 | + // AudioPlayer types |
|
| 49 | + PlaybackStartedRequest::TYPE => PlaybackStartedRequest::class, |
|
| 50 | + PlaybackNearlyFinishedRequest::TYPE => PlaybackNearlyFinishedRequest::class, |
|
| 51 | + PlaybackFinishedRequest::TYPE => PlaybackFinishedRequest::class, |
|
| 52 | + PlaybackStoppedRequest::TYPE => PlaybackStoppedRequest::class, |
|
| 53 | + PlaybackFailedRequest::TYPE => PlaybackFailedRequest::class, |
|
| 54 | + // PlaybackController types |
|
| 55 | + NextCommandIssued::TYPE => NextCommandIssued::class, |
|
| 56 | + PauseCommandIssued::TYPE => PauseCommandIssued::class, |
|
| 57 | + PlayCommandIssued::TYPE => PlayCommandIssued::class, |
|
| 58 | + PreviousCommandIssued::TYPE => PreviousCommandIssued::class, |
|
| 59 | + // System types |
|
| 60 | + ExceptionEncounteredRequest::TYPE => ExceptionEncounteredRequest::class, |
|
| 61 | + // Display types |
|
| 62 | + ElementSelectedRequest::TYPE => ElementSelectedRequest::class, |
|
| 63 | + // Game engine types |
|
| 64 | + InputHandlerEvent::TYPE => InputHandlerEvent::class, |
|
| 65 | + // can fulfill intent |
|
| 66 | + CanFulfillIntentRequest::TYPE => CanFulfillIntentRequest::class, |
|
| 67 | + // Connections Response Request |
|
| 68 | + ConnectionsResponseRequest::TYPE => ConnectionsResponseRequest::class, |
|
| 69 | + // Skill event types |
|
| 70 | + SkillAccountLinkedRequest::TYPE => SkillAccountLinkedRequest::class, |
|
| 71 | + SkillEnabledRequest::TYPE => SkillEnabledRequest::class, |
|
| 72 | + SkillDisabledRequest::TYPE => SkillDisabledRequest::class, |
|
| 73 | + SkillPermissionAcceptedRequest::TYPE => SkillPermissionAcceptedRequest::class, |
|
| 74 | + SkillPermissionChangedRequest::TYPE => SkillPermissionChangedRequest::class, |
|
| 75 | + // APL request types |
|
| 76 | + LoadIndexListDataRequest::TYPE => LoadIndexListDataRequest::class, |
|
| 77 | + LoadTokenListDataRequest::TYPE => LoadTokenListDataRequest::class, |
|
| 78 | + RuntimeErrorRequest::TYPE => RuntimeErrorRequest::class, |
|
| 79 | + UserEventRequest::TYPE => UserEventRequest::class, |
|
| 80 | + ]; |
|
| 81 | 81 | |
| 82 | - /** |
|
| 82 | + /** |
|
| 83 | 83 | * @param string|null $version Request version |
| 84 | 84 | * @param Session|null $session Session information |
| 85 | 85 | * @param Context|null $context Context information |
@@ -88,70 +88,70 @@ discard block |
||
| 88 | 88 | * @param string $signatureCertChainUrl Signature certificate chain URL |
| 89 | 89 | * @param string $signature Request signature |
| 90 | 90 | */ |
| 91 | - public function __construct( |
|
| 92 | - public ?string $version = null, |
|
| 93 | - public ?Session $session = null, |
|
| 94 | - public ?Context $context = null, |
|
| 95 | - public ?AbstractRequest $request = null, |
|
| 96 | - public string $amazonRequestBody = '', |
|
| 97 | - public string $signatureCertChainUrl = '', |
|
| 98 | - public string $signature = '', |
|
| 99 | - ) { |
|
| 100 | - } |
|
| 91 | + public function __construct( |
|
| 92 | + public ?string $version = null, |
|
| 93 | + public ?Session $session = null, |
|
| 94 | + public ?Context $context = null, |
|
| 95 | + public ?AbstractRequest $request = null, |
|
| 96 | + public string $amazonRequestBody = '', |
|
| 97 | + public string $signatureCertChainUrl = '', |
|
| 98 | + public string $signature = '', |
|
| 99 | + ) { |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 102 | + /** |
|
| 103 | 103 | * @throws MissingRequiredHeaderException |
| 104 | 104 | * @throws MissingRequestDataException |
| 105 | 105 | */ |
| 106 | - public static function fromAmazonRequest(string $amazonRequestBody, string $signatureCertChainUrl, string $signature): self |
|
| 107 | - { |
|
| 108 | - $amazonRequest = (array) json_decode($amazonRequestBody, true); |
|
| 106 | + public static function fromAmazonRequest(string $amazonRequestBody, string $signatureCertChainUrl, string $signature): self |
|
| 107 | + { |
|
| 108 | + $amazonRequest = (array) json_decode($amazonRequestBody, true); |
|
| 109 | 109 | |
| 110 | - $request = new self( |
|
| 111 | - version: PropertyHelper::checkNullValueString($amazonRequest, 'version'), |
|
| 112 | - session: isset($amazonRequest['session']) ? Session::fromAmazonRequest($amazonRequest['session']) : null, |
|
| 113 | - context: isset($amazonRequest['context']) ? Context::fromAmazonRequest($amazonRequest['context']) : null, |
|
| 114 | - amazonRequestBody: $amazonRequestBody, |
|
| 115 | - signatureCertChainUrl: $signatureCertChainUrl, |
|
| 116 | - signature: $signature, |
|
| 117 | - ); |
|
| 110 | + $request = new self( |
|
| 111 | + version: PropertyHelper::checkNullValueString($amazonRequest, 'version'), |
|
| 112 | + session: isset($amazonRequest['session']) ? Session::fromAmazonRequest($amazonRequest['session']) : null, |
|
| 113 | + context: isset($amazonRequest['context']) ? Context::fromAmazonRequest($amazonRequest['context']) : null, |
|
| 114 | + amazonRequestBody: $amazonRequestBody, |
|
| 115 | + signatureCertChainUrl: $signatureCertChainUrl, |
|
| 116 | + signature: $signature, |
|
| 117 | + ); |
|
| 118 | 118 | |
| 119 | - $request->setRequest($amazonRequest); |
|
| 120 | - $request->checkSignature(); |
|
| 119 | + $request->setRequest($amazonRequest); |
|
| 120 | + $request->checkSignature(); |
|
| 121 | 121 | |
| 122 | - return $request; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - public function getApplicationId(): ?string |
|
| 126 | - { |
|
| 127 | - // workaround for developer console |
|
| 128 | - if ($this->session && $this->session->application) { |
|
| 129 | - return $this->session->application->applicationId; |
|
| 130 | - } elseif ($this->context && ($system = $this->context->system) && $system->application) { |
|
| 131 | - return $system->application->applicationId; |
|
| 122 | + return $request; |
|
| 132 | 123 | } |
| 133 | 124 | |
| 134 | - return null; |
|
| 135 | - } |
|
| 125 | + public function getApplicationId(): ?string |
|
| 126 | + { |
|
| 127 | + // workaround for developer console |
|
| 128 | + if ($this->session && $this->session->application) { |
|
| 129 | + return $this->session->application->applicationId; |
|
| 130 | + } elseif ($this->context && ($system = $this->context->system) && $system->application) { |
|
| 131 | + return $system->application->applicationId; |
|
| 132 | + } |
|
| 136 | 133 | |
| 137 | - /** |
|
| 134 | + return null; |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | 138 | * @throws MissingRequestDataException |
| 139 | 139 | */ |
| 140 | - private function setRequest(array $amazonRequest): void |
|
| 141 | - { |
|
| 142 | - if (!isset($amazonRequest['request']['type']) || !isset(self::REQUEST_TYPES[$amazonRequest['request']['type']])) { |
|
| 143 | - throw new MissingRequestDataException(); |
|
| 140 | + private function setRequest(array $amazonRequest): void |
|
| 141 | + { |
|
| 142 | + if (!isset($amazonRequest['request']['type']) || !isset(self::REQUEST_TYPES[$amazonRequest['request']['type']])) { |
|
| 143 | + throw new MissingRequestDataException(); |
|
| 144 | + } |
|
| 145 | + $this->request = (self::REQUEST_TYPES[$amazonRequest['request']['type']])::fromAmazonRequest($amazonRequest['request']); |
|
| 144 | 146 | } |
| 145 | - $this->request = (self::REQUEST_TYPES[$amazonRequest['request']['type']])::fromAmazonRequest($amazonRequest['request']); |
|
| 146 | - } |
|
| 147 | 147 | |
| 148 | - /** |
|
| 148 | + /** |
|
| 149 | 149 | * @throws MissingRequiredHeaderException |
| 150 | 150 | */ |
| 151 | - private function checkSignature(): void |
|
| 152 | - { |
|
| 153 | - if ($this->request->validateSignature() && (!$this->signatureCertChainUrl || !$this->signature)) { |
|
| 154 | - throw new MissingRequiredHeaderException(); |
|
| 151 | + private function checkSignature(): void |
|
| 152 | + { |
|
| 153 | + if ($this->request->validateSignature() && (!$this->signatureCertChainUrl || !$this->signature)) { |
|
| 154 | + throw new MissingRequiredHeaderException(); |
|
| 155 | + } |
|
| 155 | 156 | } |
| 156 | - } |
|
| 157 | 157 | } |
@@ -110,10 +110,10 @@ |
||
| 110 | 110 | $request = new self( |
| 111 | 111 | version: PropertyHelper::checkNullValueString($amazonRequest, 'version'), |
| 112 | 112 | session: isset($amazonRequest['session']) ? Session::fromAmazonRequest($amazonRequest['session']) : null, |
| 113 | - context: isset($amazonRequest['context']) ? Context::fromAmazonRequest($amazonRequest['context']) : null, |
|
| 114 | - amazonRequestBody: $amazonRequestBody, |
|
| 115 | - signatureCertChainUrl: $signatureCertChainUrl, |
|
| 116 | - signature: $signature, |
|
| 113 | + context : isset($amazonRequest['context']) ? Context::fromAmazonRequest($amazonRequest['context']) : null, |
|
| 114 | + amazonRequestBody : $amazonRequestBody, |
|
| 115 | + signatureCertChainUrl : $signatureCertChainUrl, |
|
| 116 | + signature : $signature, |
|
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | 119 | $request->setRequest($amazonRequest); |
@@ -14,8 +14,7 @@ |
||
| 14 | 14 | * This helper class can call the amazon api to get address information. |
| 15 | 15 | * For more details @see https=>//developer.amazon.com/de/docs/custom-skills/device-address-api.html. |
| 16 | 16 | */ |
| 17 | -class DeviceAddressInformationHelper |
|
| 18 | -{ |
|
| 17 | +class DeviceAddressInformationHelper { |
|
| 19 | 18 | public function __construct( |
| 20 | 19 | private readonly Client $client = new Client() |
| 21 | 20 | ) { |
@@ -1,75 +1,75 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | + declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | -namespace MaxBeckers\AmazonAlexa\Helper; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Helper; |
|
| 6 | 6 | |
| 7 | -use GuzzleHttp\Client; |
|
| 8 | -use MaxBeckers\AmazonAlexa\Exception\DeviceApiCallException; |
|
| 9 | -use MaxBeckers\AmazonAlexa\Exception\MissingRequestDataException; |
|
| 10 | -use MaxBeckers\AmazonAlexa\Request\Device\DeviceAddressInformation; |
|
| 11 | -use MaxBeckers\AmazonAlexa\Request\Request; |
|
| 7 | + use GuzzleHttp\Client; |
|
| 8 | + use MaxBeckers\AmazonAlexa\Exception\DeviceApiCallException; |
|
| 9 | + use MaxBeckers\AmazonAlexa\Exception\MissingRequestDataException; |
|
| 10 | + use MaxBeckers\AmazonAlexa\Request\Device\DeviceAddressInformation; |
|
| 11 | + use MaxBeckers\AmazonAlexa\Request\Request; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * This helper class can call the amazon api to get address information. |
| 15 | 15 | * For more details @see https=>//developer.amazon.com/de/docs/custom-skills/device-address-api.html. |
| 16 | 16 | */ |
| 17 | -class DeviceAddressInformationHelper |
|
| 18 | -{ |
|
| 19 | - public function __construct( |
|
| 20 | - private readonly Client $client = new Client() |
|
| 21 | - ) { |
|
| 22 | - } |
|
| 17 | + class DeviceAddressInformationHelper |
|
| 18 | + { |
|
| 19 | + public function __construct( |
|
| 20 | + private readonly Client $client = new Client() |
|
| 21 | + ) { |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * @throws MissingRequestDataException |
| 26 | 26 | */ |
| 27 | - public function getCountryAndPostalCode(Request $request): DeviceAddressInformation |
|
| 28 | - { |
|
| 29 | - if (!isset($request->context->system->device->deviceId, $request->context->system->apiAccessToken, $request->context->system->apiEndpoint)) { |
|
| 30 | - throw new MissingRequestDataException(); |
|
| 31 | - } |
|
| 27 | + public function getCountryAndPostalCode(Request $request): DeviceAddressInformation |
|
| 28 | + { |
|
| 29 | + if (!isset($request->context->system->device->deviceId, $request->context->system->apiAccessToken, $request->context->system->apiEndpoint)) { |
|
| 30 | + throw new MissingRequestDataException(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - $deviceId = $request->context->system->device->deviceId; |
|
| 34 | - $token = $request->context->system->apiAccessToken; |
|
| 35 | - $endpoint = $request->context->system->apiEndpoint; |
|
| 33 | + $deviceId = $request->context->system->device->deviceId; |
|
| 34 | + $token = $request->context->system->apiAccessToken; |
|
| 35 | + $endpoint = $request->context->system->apiEndpoint; |
|
| 36 | 36 | |
| 37 | - $url = sprintf('%s/v1/devices/%s/settings/address/countryAndPostalCode', $endpoint, $deviceId); |
|
| 37 | + $url = sprintf('%s/v1/devices/%s/settings/address/countryAndPostalCode', $endpoint, $deviceId); |
|
| 38 | 38 | |
| 39 | - return $this->apiCall($url, $token); |
|
| 40 | - } |
|
| 39 | + return $this->apiCall($url, $token); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 42 | + /** |
|
| 43 | 43 | * @throws MissingRequestDataException |
| 44 | 44 | */ |
| 45 | - public function getAddress(Request $request): DeviceAddressInformation |
|
| 46 | - { |
|
| 47 | - if (!isset($request->context->system->device->deviceId, $request->context->system->apiAccessToken, $request->context->system->apiEndpoint)) { |
|
| 48 | - throw new MissingRequestDataException(); |
|
| 49 | - } |
|
| 45 | + public function getAddress(Request $request): DeviceAddressInformation |
|
| 46 | + { |
|
| 47 | + if (!isset($request->context->system->device->deviceId, $request->context->system->apiAccessToken, $request->context->system->apiEndpoint)) { |
|
| 48 | + throw new MissingRequestDataException(); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - $deviceId = $request->context->system->device->deviceId; |
|
| 52 | - $token = $request->context->system->apiAccessToken; |
|
| 53 | - $endpoint = $request->context->system->apiEndpoint; |
|
| 51 | + $deviceId = $request->context->system->device->deviceId; |
|
| 52 | + $token = $request->context->system->apiAccessToken; |
|
| 53 | + $endpoint = $request->context->system->apiEndpoint; |
|
| 54 | 54 | |
| 55 | - $url = sprintf('%s/v1/devices/%s/settings/address', $endpoint, $deviceId); |
|
| 55 | + $url = sprintf('%s/v1/devices/%s/settings/address', $endpoint, $deviceId); |
|
| 56 | 56 | |
| 57 | - return $this->apiCall($url, $token); |
|
| 58 | - } |
|
| 57 | + return $this->apiCall($url, $token); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 60 | + /** |
|
| 61 | 61 | * @throws DeviceApiCallException |
| 62 | 62 | */ |
| 63 | - private function apiCall(string $url, string $token): DeviceAddressInformation |
|
| 64 | - { |
|
| 65 | - $response = $this->client->request('GET', $url, [ |
|
| 66 | - 'headers' => [ |
|
| 67 | - 'Authorization' => 'Bearer ' . $token, |
|
| 68 | - 'Accept' => 'application/json', |
|
| 69 | - ], |
|
| 70 | - ]); |
|
| 63 | + private function apiCall(string $url, string $token): DeviceAddressInformation |
|
| 64 | + { |
|
| 65 | + $response = $this->client->request('GET', $url, [ |
|
| 66 | + 'headers' => [ |
|
| 67 | + 'Authorization' => 'Bearer ' . $token, |
|
| 68 | + 'Accept' => 'application/json', |
|
| 69 | + ], |
|
| 70 | + ]); |
|
| 71 | 71 | |
| 72 | - /* |
|
| 72 | + /* |
|
| 73 | 73 | * Api Call response codes: |
| 74 | 74 | * 200 OK Successfully got the address associated with this deviceId. |
| 75 | 75 | * 204 No Content The query did not return any results. |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | * 429 Too Many Requests The skill has been throttled due to an excessive number of requests. |
| 79 | 79 | * 500 Internal Error An unexpected error occurred. |
| 80 | 80 | */ |
| 81 | - if (200 !== $response->getStatusCode()) { |
|
| 82 | - throw new DeviceApiCallException(sprintf('Error in api call (status code:"%s")', $response->getStatusCode())); |
|
| 83 | - } |
|
| 81 | + if (200 !== $response->getStatusCode()) { |
|
| 82 | + throw new DeviceApiCallException(sprintf('Error in api call (status code:"%s")', $response->getStatusCode())); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - return DeviceAddressInformation::fromApiResponse(json_decode($response->getBody()->getContents(), true)); |
|
| 86 | - } |
|
| 85 | + return DeviceAddressInformation::fromApiResponse(json_decode($response->getBody()->getContents(), true)); |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -7,8 +7,7 @@ |
||
| 7 | 7 | /** |
| 8 | 8 | * This trait is helpful for the property to ArrayObject mapping. |
| 9 | 9 | */ |
| 10 | -trait SerializeValueMapper |
|
| 11 | -{ |
|
| 10 | +trait SerializeValueMapper { |
|
| 12 | 11 | protected function valueToArrayIfSet(\ArrayObject $data, string $property): void |
| 13 | 12 | { |
| 14 | 13 | if (null !== $this->{$property}) { |
@@ -1,18 +1,18 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | + declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | -namespace MaxBeckers\AmazonAlexa\Helper; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Helper; |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * This trait is helpful for the property to ArrayObject mapping. |
| 9 | 9 | */ |
| 10 | -trait SerializeValueMapper |
|
| 11 | -{ |
|
| 12 | - protected function valueToArrayIfSet(\ArrayObject $data, string $property): void |
|
| 10 | + trait SerializeValueMapper |
|
| 13 | 11 | { |
| 14 | - if (null !== $this->{$property}) { |
|
| 15 | - $data[$property] = $this->{$property}; |
|
| 12 | + protected function valueToArrayIfSet(\ArrayObject $data, string $property): void |
|
| 13 | + { |
|
| 14 | + if (null !== $this->{$property}) { |
|
| 15 | + $data[$property] = $this->{$property}; |
|
| 16 | + } |
|
| 16 | 17 | } |
| 17 | - } |
|
| 18 | 18 | } |
@@ -7,8 +7,7 @@ |
||
| 7 | 7 | /** |
| 8 | 8 | * This helper class simplifies the property handling. |
| 9 | 9 | */ |
| 10 | -class PropertyHelper |
|
| 11 | -{ |
|
| 10 | +class PropertyHelper { |
|
| 12 | 11 | public static function checkNullValueString(array $data, string $key): ?string |
| 13 | 12 | { |
| 14 | 13 | return $data[$key] ?? null; |
@@ -1,26 +1,26 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | + declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | -namespace MaxBeckers\AmazonAlexa\Helper; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Helper; |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * This helper class simplifies the property handling. |
| 9 | 9 | */ |
| 10 | -class PropertyHelper |
|
| 11 | -{ |
|
| 12 | - public static function checkNullValueString(array $data, string $key): ?string |
|
| 10 | + class PropertyHelper |
|
| 13 | 11 | { |
| 14 | - return $data[$key] ?? null; |
|
| 15 | - } |
|
| 12 | + public static function checkNullValueString(array $data, string $key): ?string |
|
| 13 | + { |
|
| 14 | + return $data[$key] ?? null; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - public static function checkNullValueInt(array $data, string $key): ?int |
|
| 18 | - { |
|
| 19 | - return $data[$key] ?? null; |
|
| 20 | - } |
|
| 17 | + public static function checkNullValueInt(array $data, string $key): ?int |
|
| 18 | + { |
|
| 19 | + return $data[$key] ?? null; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - public static function checkNullValueStringOrInt(array $data, string $key): string|int|null |
|
| 23 | - { |
|
| 24 | - return $data[$key] ?? null; |
|
| 25 | - } |
|
| 22 | + public static function checkNullValueStringOrInt(array $data, string $key): string|int|null |
|
| 23 | + { |
|
| 24 | + return $data[$key] ?? null; |
|
| 25 | + } |
|
| 26 | 26 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | return $data[$key] ?? null; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public static function checkNullValueStringOrInt(array $data, string $key): string|int|null |
|
| 22 | + public static function checkNullValueStringOrInt(array $data, string $key): string | int | null |
|
| 23 | 23 | { |
| 24 | 24 | return $data[$key] ?? null; |
| 25 | 25 | } |
@@ -4,8 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | namespace MaxBeckers\AmazonAlexa\Helper; |
| 6 | 6 | |
| 7 | -interface SsmlTypes |
|
| 8 | -{ |
|
| 7 | +interface SsmlTypes { |
|
| 9 | 8 | public const AMAZON_EFFECT_WHISPERED = 'whispered'; |
| 10 | 9 | public const AMAZON_EFFECTS = [self::AMAZON_EFFECT_WHISPERED]; |
| 11 | 10 | public const BREAK_STRENGTH_NONE = 'none'; |
@@ -1,209 +1,209 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | + declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | -namespace MaxBeckers\AmazonAlexa\Helper; |
|
| 5 | + namespace MaxBeckers\AmazonAlexa\Helper; |
|
| 6 | 6 | |
| 7 | -interface SsmlTypes |
|
| 8 | -{ |
|
| 9 | - public const AMAZON_EFFECT_WHISPERED = 'whispered'; |
|
| 10 | - public const AMAZON_EFFECTS = [self::AMAZON_EFFECT_WHISPERED]; |
|
| 11 | - public const BREAK_STRENGTH_NONE = 'none'; |
|
| 12 | - public const BREAK_STRENGTH_X_WEAK = 'x-weak'; |
|
| 13 | - public const BREAK_STRENGTH_WEAK = 'weak'; |
|
| 14 | - public const BREAK_STRENGTH_MEDIUM = 'medium'; |
|
| 15 | - public const BREAK_STRENGTH_STRONG = 'strong'; |
|
| 16 | - public const BREAK_STRENGTH_X_STRONG = 'x-strong'; |
|
| 17 | - public const BREAK_STRENGTHS = [ |
|
| 18 | - self::BREAK_STRENGTH_NONE, |
|
| 19 | - self::BREAK_STRENGTH_X_WEAK, |
|
| 20 | - self::BREAK_STRENGTH_WEAK, |
|
| 21 | - self::BREAK_STRENGTH_MEDIUM, |
|
| 22 | - self::BREAK_STRENGTH_STRONG, |
|
| 23 | - self::BREAK_STRENGTH_X_STRONG, |
|
| 24 | - ]; |
|
| 25 | - public const EMPHASIS_LEVEL_STRONG = 'strong'; |
|
| 26 | - public const EMPHASIS_LEVEL_MODERATE = 'moderate'; |
|
| 27 | - public const EMPHASIS_LEVEL_REDUCED = 'reduced'; |
|
| 28 | - public const EMPHASIS_LEVELS = [ |
|
| 29 | - self::EMPHASIS_LEVEL_STRONG, |
|
| 30 | - self::EMPHASIS_LEVEL_MODERATE, |
|
| 31 | - self::EMPHASIS_LEVEL_REDUCED, |
|
| 32 | - ]; |
|
| 33 | - public const LANGUAGE_EN_US = 'en-US'; |
|
| 34 | - public const LANGUAGE_EN_GB = 'en-GB'; |
|
| 35 | - public const LANGUAGE_EN_IN = 'en-IN'; |
|
| 36 | - public const LANGUAGE_EN_AU = 'en-AU'; |
|
| 37 | - public const LANGUAGE_EN_CA = 'en-CA'; |
|
| 38 | - public const LANGUAGE_DE_DE = 'de-DE'; |
|
| 39 | - public const LANGUAGE_ES_ES = 'es-ES'; |
|
| 40 | - public const LANGUAGE_IT_IT = 'it-IT'; |
|
| 41 | - public const LANGUAGE_JA_JP = 'ja-JP'; |
|
| 42 | - public const LANGUAGE_FR_FR = 'fr-FR'; |
|
| 43 | - public const LANGUAGE_LIST = [ |
|
| 44 | - self::LANGUAGE_EN_US, |
|
| 45 | - self::LANGUAGE_EN_GB, |
|
| 46 | - self::LANGUAGE_EN_IN, |
|
| 47 | - self::LANGUAGE_EN_AU, |
|
| 48 | - self::LANGUAGE_EN_CA, |
|
| 49 | - self::LANGUAGE_DE_DE, |
|
| 50 | - self::LANGUAGE_ES_ES, |
|
| 51 | - self::LANGUAGE_IT_IT, |
|
| 52 | - self::LANGUAGE_JA_JP, |
|
| 53 | - self::LANGUAGE_FR_FR, |
|
| 54 | - ]; |
|
| 55 | - public const PHONEME_ALPHABET_IPA = 'ipa'; |
|
| 56 | - public const PHONEME_ALPHABET_X_SAMPA = 'x-sampa'; |
|
| 57 | - public const PHONEME_ALPHABETS = [ |
|
| 58 | - self::PHONEME_ALPHABET_IPA, |
|
| 59 | - self::PHONEME_ALPHABET_X_SAMPA, |
|
| 60 | - ]; |
|
| 61 | - public const PROSODY_PITCH = 'pitch'; |
|
| 62 | - public const PROSODY_PITCH_X_LOW = 'x-low'; |
|
| 63 | - public const PROSODY_PITCH_LOW = 'low'; |
|
| 64 | - public const PROSODY_PITCH_MEDIUM = 'medium'; |
|
| 65 | - public const PROSODY_PITCH_LOUD = 'loud'; |
|
| 66 | - public const PROSODY_PITCH_X_LOUD = 'x-loud'; |
|
| 67 | - public const PROSODY_PITCH_PERCENT_UP = '+n%'; |
|
| 68 | - public const PROSODY_PITCH_PERCENT_DOWN = '-n%'; |
|
| 69 | - public const PROSODY_RATE = 'rate'; |
|
| 70 | - public const PROSODY_RATE_X_SLOW = 'x-slow'; |
|
| 71 | - public const PROSODY_RATE_SLOW = 'slow'; |
|
| 72 | - public const PROSODY_RATE_MEDIUM = 'medium'; |
|
| 73 | - public const PROSODY_RATE_FAST = 'fast'; |
|
| 74 | - public const PROSODY_RATE_X_FAST = 'x-fast'; |
|
| 75 | - public const PROSODY_RATE_PERCENT = 'n%'; |
|
| 76 | - public const PROSODY_VOLUME = 'volume'; |
|
| 77 | - public const PROSODY_VOLUME_SILENT = 'silent'; |
|
| 78 | - public const PROSODY_VOLUME_X_SOFT = 'x-soft'; |
|
| 79 | - public const PROSODY_VOLUME_SOFT = 'soft'; |
|
| 80 | - public const PROSODY_VOLUME_MEDIUM = 'medium'; |
|
| 81 | - public const PROSODY_VOLUME_LOUD = 'loud'; |
|
| 82 | - public const PROSODY_VOLUME_X_LOUD = 'x-loud'; |
|
| 83 | - public const PROSODY_VOLUME_DB_UP = '+ndB'; |
|
| 84 | - public const PROSODY_VOLUME_DB_DOWN = '-ndB'; |
|
| 85 | - public const PROSODIES = [ |
|
| 86 | - self::PROSODY_PITCH => [ |
|
| 87 | - self::PROSODY_PITCH_X_LOW, |
|
| 88 | - self::PROSODY_PITCH_LOW, |
|
| 89 | - self::PROSODY_PITCH_MEDIUM, |
|
| 90 | - self::PROSODY_PITCH_LOUD, |
|
| 91 | - self::PROSODY_PITCH_X_LOUD, |
|
| 92 | - self::PROSODY_PITCH_PERCENT_UP, |
|
| 93 | - self::PROSODY_PITCH_PERCENT_DOWN, |
|
| 94 | - ], |
|
| 95 | - self::PROSODY_RATE => [ |
|
| 96 | - self::PROSODY_RATE_X_SLOW, |
|
| 97 | - self::PROSODY_RATE_SLOW, |
|
| 98 | - self::PROSODY_RATE_MEDIUM, |
|
| 99 | - self::PROSODY_RATE_FAST, |
|
| 100 | - self::PROSODY_RATE_X_FAST, |
|
| 101 | - self::PROSODY_RATE_PERCENT, |
|
| 102 | - ], |
|
| 103 | - self::PROSODY_VOLUME => [ |
|
| 104 | - self::PROSODY_VOLUME_SILENT, |
|
| 105 | - self::PROSODY_VOLUME_X_SOFT, |
|
| 106 | - self::PROSODY_VOLUME_SOFT, |
|
| 107 | - self::PROSODY_VOLUME_MEDIUM, |
|
| 108 | - self::PROSODY_VOLUME_LOUD, |
|
| 109 | - self::PROSODY_VOLUME_X_LOUD, |
|
| 110 | - self::PROSODY_VOLUME_DB_UP, |
|
| 111 | - self::PROSODY_VOLUME_DB_DOWN, |
|
| 112 | - ], |
|
| 113 | - ]; |
|
| 114 | - public const SAY_AS_INTERPRET_CHARACTERS = 'characters'; |
|
| 115 | - public const SAY_AS_INTERPRET_SPELL_OUT = 'spell-out'; |
|
| 116 | - public const SAY_AS_INTERPRET_CARDINAL = 'cardinal'; |
|
| 117 | - public const SAY_AS_INTERPRET_NUMBER = 'number'; |
|
| 118 | - public const SAY_AS_INTERPRET_ORDINAL = 'ordinal'; |
|
| 119 | - public const SAY_AS_INTERPRET_DIGITS = 'digits'; |
|
| 120 | - public const SAY_AS_INTERPRET_FRACTION = 'fraction'; |
|
| 121 | - public const SAY_AS_INTERPRET_UNIT = 'unit'; |
|
| 122 | - public const SAY_AS_INTERPRET_DATE = 'date'; |
|
| 123 | - public const SAY_AS_INTERPRET_TIME = 'time'; |
|
| 124 | - public const SAY_AS_INTERPRET_TELEPHONE = 'telephone'; |
|
| 125 | - public const SAY_AS_INTERPRET_ADDRESS = 'address'; |
|
| 126 | - public const SAY_AS_INTERPRET_INTERJECTION = 'interjection'; |
|
| 127 | - public const SAY_AS_INTERPRET_EXPLETIVE = 'expletive'; |
|
| 128 | - public const SAY_AS_INTERPRET_AS = [ |
|
| 129 | - self::SAY_AS_INTERPRET_CHARACTERS, |
|
| 130 | - self::SAY_AS_INTERPRET_SPELL_OUT, |
|
| 131 | - self::SAY_AS_INTERPRET_CARDINAL, |
|
| 132 | - self::SAY_AS_INTERPRET_NUMBER, |
|
| 133 | - self::SAY_AS_INTERPRET_ORDINAL, |
|
| 134 | - self::SAY_AS_INTERPRET_DIGITS, |
|
| 135 | - self::SAY_AS_INTERPRET_FRACTION, |
|
| 136 | - self::SAY_AS_INTERPRET_UNIT, |
|
| 137 | - self::SAY_AS_INTERPRET_DATE, |
|
| 138 | - self::SAY_AS_INTERPRET_TIME, |
|
| 139 | - self::SAY_AS_INTERPRET_TELEPHONE, |
|
| 140 | - self::SAY_AS_INTERPRET_ADDRESS, |
|
| 141 | - self::SAY_AS_INTERPRET_INTERJECTION, |
|
| 142 | - self::SAY_AS_INTERPRET_EXPLETIVE, |
|
| 143 | - ]; |
|
| 144 | - public const VOICE_EN_US_IVY = 'Ivy'; |
|
| 145 | - public const VOICE_EN_US_JOANNA = 'Joanna'; |
|
| 146 | - public const VOICE_EN_US_JOEY = 'Joey'; |
|
| 147 | - public const VOICE_EN_US_JUSTIN = 'Justin'; |
|
| 148 | - public const VOICE_EN_US_KENDRA = 'Kendra'; |
|
| 149 | - public const VOICE_EN_US_KIMBERLY = 'Kimberly'; |
|
| 150 | - public const VOICE_EN_US_MATTHEW = 'Matthew'; |
|
| 151 | - public const VOICE_EN_US_SALLI = 'Salli'; |
|
| 152 | - public const VOICE_EN_AU_NICOLE = 'Nicole'; |
|
| 153 | - public const VOICE_EN_AU_RUSSELL = 'Russell'; |
|
| 154 | - public const VOICE_EN_GB_AMY = 'Amy'; |
|
| 155 | - public const VOICE_EN_GB_BRIAN = 'Brian'; |
|
| 156 | - public const VOICE_EN_GB_EMMA = 'Emma'; |
|
| 157 | - public const VOICE_EN_IN_ADITI = 'Aditi'; |
|
| 158 | - public const VOICE_EN_IN_RAVEENA = 'Raveena'; |
|
| 159 | - public const VOICE_DE_DE_HANS = 'Hans'; |
|
| 160 | - public const VOICE_DE_DE_MARLENE = 'Marlene'; |
|
| 161 | - public const VOICE_DE_DE_VICKI = 'Vicki'; |
|
| 162 | - public const VOICE_ES_ES_CONCHITA = 'Conchita'; |
|
| 163 | - public const VOICE_ES_ES_ENRIQUE = 'Enrique'; |
|
| 164 | - public const VOICE_IT_IT_CARLA = 'Carla'; |
|
| 165 | - public const VOICE_IT_IT_GIORGIO = 'Giorgio'; |
|
| 166 | - public const VOICE_JA_JP_MIZUKI = 'Mizuki'; |
|
| 167 | - public const VOICE_JA_JP_TAKUMI = 'Takumi'; |
|
| 168 | - public const VOICE_FR_FR_CELINE = 'Celine'; |
|
| 169 | - public const VOICE_FR_FR_LEA = 'Lea'; |
|
| 170 | - public const VOICE_FR_FR_MATHIEU = 'Mathieu'; |
|
| 171 | - public const VOICES = [ |
|
| 172 | - self::VOICE_EN_US_IVY, |
|
| 173 | - self::VOICE_EN_US_JOANNA, |
|
| 174 | - self::VOICE_EN_US_JOEY, |
|
| 175 | - self::VOICE_EN_US_JUSTIN, |
|
| 176 | - self::VOICE_EN_US_KENDRA, |
|
| 177 | - self::VOICE_EN_US_KIMBERLY, |
|
| 178 | - self::VOICE_EN_US_MATTHEW, |
|
| 179 | - self::VOICE_EN_US_SALLI, |
|
| 180 | - self::VOICE_EN_AU_RUSSELL, |
|
| 181 | - self::VOICE_EN_GB_AMY, |
|
| 182 | - self::VOICE_EN_GB_BRIAN, |
|
| 183 | - self::VOICE_EN_GB_EMMA, |
|
| 184 | - self::VOICE_EN_IN_ADITI, |
|
| 185 | - self::VOICE_EN_IN_RAVEENA, |
|
| 186 | - self::VOICE_DE_DE_HANS, |
|
| 187 | - self::VOICE_DE_DE_MARLENE, |
|
| 188 | - self::VOICE_DE_DE_VICKI, |
|
| 189 | - self::VOICE_ES_ES_CONCHITA, |
|
| 190 | - self::VOICE_ES_ES_ENRIQUE, |
|
| 191 | - self::VOICE_IT_IT_CARLA, |
|
| 192 | - self::VOICE_IT_IT_GIORGIO, |
|
| 193 | - self::VOICE_JA_JP_MIZUKI, |
|
| 194 | - self::VOICE_JA_JP_TAKUMI, |
|
| 195 | - self::VOICE_FR_FR_CELINE, |
|
| 196 | - self::VOICE_FR_FR_LEA, |
|
| 197 | - self::VOICE_FR_FR_MATHIEU, |
|
| 198 | - ]; |
|
| 199 | - public const INTERPRET_WORD_VB = 'amazon:VB'; |
|
| 200 | - public const INTERPRET_WORD_VBD = 'amazon:VBD'; |
|
| 201 | - public const INTERPRET_WORD_NN = 'amazon:NN'; |
|
| 202 | - public const INTERPRET_WORD_SENSE_1 = 'amazon:SENSE_1'; |
|
| 203 | - public const INTERPRET_WORDS = [ |
|
| 204 | - self::INTERPRET_WORD_VB, |
|
| 205 | - self::INTERPRET_WORD_VBD, |
|
| 206 | - self::INTERPRET_WORD_NN, |
|
| 207 | - self::INTERPRET_WORD_SENSE_1, |
|
| 208 | - ]; |
|
| 7 | + interface SsmlTypes |
|
| 8 | + { |
|
| 9 | + public const AMAZON_EFFECT_WHISPERED = 'whispered'; |
|
| 10 | + public const AMAZON_EFFECTS = [self::AMAZON_EFFECT_WHISPERED]; |
|
| 11 | + public const BREAK_STRENGTH_NONE = 'none'; |
|
| 12 | + public const BREAK_STRENGTH_X_WEAK = 'x-weak'; |
|
| 13 | + public const BREAK_STRENGTH_WEAK = 'weak'; |
|
| 14 | + public const BREAK_STRENGTH_MEDIUM = 'medium'; |
|
| 15 | + public const BREAK_STRENGTH_STRONG = 'strong'; |
|
| 16 | + public const BREAK_STRENGTH_X_STRONG = 'x-strong'; |
|
| 17 | + public const BREAK_STRENGTHS = [ |
|
| 18 | + self::BREAK_STRENGTH_NONE, |
|
| 19 | + self::BREAK_STRENGTH_X_WEAK, |
|
| 20 | + self::BREAK_STRENGTH_WEAK, |
|
| 21 | + self::BREAK_STRENGTH_MEDIUM, |
|
| 22 | + self::BREAK_STRENGTH_STRONG, |
|
| 23 | + self::BREAK_STRENGTH_X_STRONG, |
|
| 24 | + ]; |
|
| 25 | + public const EMPHASIS_LEVEL_STRONG = 'strong'; |
|
| 26 | + public const EMPHASIS_LEVEL_MODERATE = 'moderate'; |
|
| 27 | + public const EMPHASIS_LEVEL_REDUCED = 'reduced'; |
|
| 28 | + public const EMPHASIS_LEVELS = [ |
|
| 29 | + self::EMPHASIS_LEVEL_STRONG, |
|
| 30 | + self::EMPHASIS_LEVEL_MODERATE, |
|
| 31 | + self::EMPHASIS_LEVEL_REDUCED, |
|
| 32 | + ]; |
|
| 33 | + public const LANGUAGE_EN_US = 'en-US'; |
|
| 34 | + public const LANGUAGE_EN_GB = 'en-GB'; |
|
| 35 | + public const LANGUAGE_EN_IN = 'en-IN'; |
|
| 36 | + public const LANGUAGE_EN_AU = 'en-AU'; |
|
| 37 | + public const LANGUAGE_EN_CA = 'en-CA'; |
|
| 38 | + public const LANGUAGE_DE_DE = 'de-DE'; |
|
| 39 | + public const LANGUAGE_ES_ES = 'es-ES'; |
|
| 40 | + public const LANGUAGE_IT_IT = 'it-IT'; |
|
| 41 | + public const LANGUAGE_JA_JP = 'ja-JP'; |
|
| 42 | + public const LANGUAGE_FR_FR = 'fr-FR'; |
|
| 43 | + public const LANGUAGE_LIST = [ |
|
| 44 | + self::LANGUAGE_EN_US, |
|
| 45 | + self::LANGUAGE_EN_GB, |
|
| 46 | + self::LANGUAGE_EN_IN, |
|
| 47 | + self::LANGUAGE_EN_AU, |
|
| 48 | + self::LANGUAGE_EN_CA, |
|
| 49 | + self::LANGUAGE_DE_DE, |
|
| 50 | + self::LANGUAGE_ES_ES, |
|
| 51 | + self::LANGUAGE_IT_IT, |
|
| 52 | + self::LANGUAGE_JA_JP, |
|
| 53 | + self::LANGUAGE_FR_FR, |
|
| 54 | + ]; |
|
| 55 | + public const PHONEME_ALPHABET_IPA = 'ipa'; |
|
| 56 | + public const PHONEME_ALPHABET_X_SAMPA = 'x-sampa'; |
|
| 57 | + public const PHONEME_ALPHABETS = [ |
|
| 58 | + self::PHONEME_ALPHABET_IPA, |
|
| 59 | + self::PHONEME_ALPHABET_X_SAMPA, |
|
| 60 | + ]; |
|
| 61 | + public const PROSODY_PITCH = 'pitch'; |
|
| 62 | + public const PROSODY_PITCH_X_LOW = 'x-low'; |
|
| 63 | + public const PROSODY_PITCH_LOW = 'low'; |
|
| 64 | + public const PROSODY_PITCH_MEDIUM = 'medium'; |
|
| 65 | + public const PROSODY_PITCH_LOUD = 'loud'; |
|
| 66 | + public const PROSODY_PITCH_X_LOUD = 'x-loud'; |
|
| 67 | + public const PROSODY_PITCH_PERCENT_UP = '+n%'; |
|
| 68 | + public const PROSODY_PITCH_PERCENT_DOWN = '-n%'; |
|
| 69 | + public const PROSODY_RATE = 'rate'; |
|
| 70 | + public const PROSODY_RATE_X_SLOW = 'x-slow'; |
|
| 71 | + public const PROSODY_RATE_SLOW = 'slow'; |
|
| 72 | + public const PROSODY_RATE_MEDIUM = 'medium'; |
|
| 73 | + public const PROSODY_RATE_FAST = 'fast'; |
|
| 74 | + public const PROSODY_RATE_X_FAST = 'x-fast'; |
|
| 75 | + public const PROSODY_RATE_PERCENT = 'n%'; |
|
| 76 | + public const PROSODY_VOLUME = 'volume'; |
|
| 77 | + public const PROSODY_VOLUME_SILENT = 'silent'; |
|
| 78 | + public const PROSODY_VOLUME_X_SOFT = 'x-soft'; |
|
| 79 | + public const PROSODY_VOLUME_SOFT = 'soft'; |
|
| 80 | + public const PROSODY_VOLUME_MEDIUM = 'medium'; |
|
| 81 | + public const PROSODY_VOLUME_LOUD = 'loud'; |
|
| 82 | + public const PROSODY_VOLUME_X_LOUD = 'x-loud'; |
|
| 83 | + public const PROSODY_VOLUME_DB_UP = '+ndB'; |
|
| 84 | + public const PROSODY_VOLUME_DB_DOWN = '-ndB'; |
|
| 85 | + public const PROSODIES = [ |
|
| 86 | + self::PROSODY_PITCH => [ |
|
| 87 | + self::PROSODY_PITCH_X_LOW, |
|
| 88 | + self::PROSODY_PITCH_LOW, |
|
| 89 | + self::PROSODY_PITCH_MEDIUM, |
|
| 90 | + self::PROSODY_PITCH_LOUD, |
|
| 91 | + self::PROSODY_PITCH_X_LOUD, |
|
| 92 | + self::PROSODY_PITCH_PERCENT_UP, |
|
| 93 | + self::PROSODY_PITCH_PERCENT_DOWN, |
|
| 94 | + ], |
|
| 95 | + self::PROSODY_RATE => [ |
|
| 96 | + self::PROSODY_RATE_X_SLOW, |
|
| 97 | + self::PROSODY_RATE_SLOW, |
|
| 98 | + self::PROSODY_RATE_MEDIUM, |
|
| 99 | + self::PROSODY_RATE_FAST, |
|
| 100 | + self::PROSODY_RATE_X_FAST, |
|
| 101 | + self::PROSODY_RATE_PERCENT, |
|
| 102 | + ], |
|
| 103 | + self::PROSODY_VOLUME => [ |
|
| 104 | + self::PROSODY_VOLUME_SILENT, |
|
| 105 | + self::PROSODY_VOLUME_X_SOFT, |
|
| 106 | + self::PROSODY_VOLUME_SOFT, |
|
| 107 | + self::PROSODY_VOLUME_MEDIUM, |
|
| 108 | + self::PROSODY_VOLUME_LOUD, |
|
| 109 | + self::PROSODY_VOLUME_X_LOUD, |
|
| 110 | + self::PROSODY_VOLUME_DB_UP, |
|
| 111 | + self::PROSODY_VOLUME_DB_DOWN, |
|
| 112 | + ], |
|
| 113 | + ]; |
|
| 114 | + public const SAY_AS_INTERPRET_CHARACTERS = 'characters'; |
|
| 115 | + public const SAY_AS_INTERPRET_SPELL_OUT = 'spell-out'; |
|
| 116 | + public const SAY_AS_INTERPRET_CARDINAL = 'cardinal'; |
|
| 117 | + public const SAY_AS_INTERPRET_NUMBER = 'number'; |
|
| 118 | + public const SAY_AS_INTERPRET_ORDINAL = 'ordinal'; |
|
| 119 | + public const SAY_AS_INTERPRET_DIGITS = 'digits'; |
|
| 120 | + public const SAY_AS_INTERPRET_FRACTION = 'fraction'; |
|
| 121 | + public const SAY_AS_INTERPRET_UNIT = 'unit'; |
|
| 122 | + public const SAY_AS_INTERPRET_DATE = 'date'; |
|
| 123 | + public const SAY_AS_INTERPRET_TIME = 'time'; |
|
| 124 | + public const SAY_AS_INTERPRET_TELEPHONE = 'telephone'; |
|
| 125 | + public const SAY_AS_INTERPRET_ADDRESS = 'address'; |
|
| 126 | + public const SAY_AS_INTERPRET_INTERJECTION = 'interjection'; |
|
| 127 | + public const SAY_AS_INTERPRET_EXPLETIVE = 'expletive'; |
|
| 128 | + public const SAY_AS_INTERPRET_AS = [ |
|
| 129 | + self::SAY_AS_INTERPRET_CHARACTERS, |
|
| 130 | + self::SAY_AS_INTERPRET_SPELL_OUT, |
|
| 131 | + self::SAY_AS_INTERPRET_CARDINAL, |
|
| 132 | + self::SAY_AS_INTERPRET_NUMBER, |
|
| 133 | + self::SAY_AS_INTERPRET_ORDINAL, |
|
| 134 | + self::SAY_AS_INTERPRET_DIGITS, |
|
| 135 | + self::SAY_AS_INTERPRET_FRACTION, |
|
| 136 | + self::SAY_AS_INTERPRET_UNIT, |
|
| 137 | + self::SAY_AS_INTERPRET_DATE, |
|
| 138 | + self::SAY_AS_INTERPRET_TIME, |
|
| 139 | + self::SAY_AS_INTERPRET_TELEPHONE, |
|
| 140 | + self::SAY_AS_INTERPRET_ADDRESS, |
|
| 141 | + self::SAY_AS_INTERPRET_INTERJECTION, |
|
| 142 | + self::SAY_AS_INTERPRET_EXPLETIVE, |
|
| 143 | + ]; |
|
| 144 | + public const VOICE_EN_US_IVY = 'Ivy'; |
|
| 145 | + public const VOICE_EN_US_JOANNA = 'Joanna'; |
|
| 146 | + public const VOICE_EN_US_JOEY = 'Joey'; |
|
| 147 | + public const VOICE_EN_US_JUSTIN = 'Justin'; |
|
| 148 | + public const VOICE_EN_US_KENDRA = 'Kendra'; |
|
| 149 | + public const VOICE_EN_US_KIMBERLY = 'Kimberly'; |
|
| 150 | + public const VOICE_EN_US_MATTHEW = 'Matthew'; |
|
| 151 | + public const VOICE_EN_US_SALLI = 'Salli'; |
|
| 152 | + public const VOICE_EN_AU_NICOLE = 'Nicole'; |
|
| 153 | + public const VOICE_EN_AU_RUSSELL = 'Russell'; |
|
| 154 | + public const VOICE_EN_GB_AMY = 'Amy'; |
|
| 155 | + public const VOICE_EN_GB_BRIAN = 'Brian'; |
|
| 156 | + public const VOICE_EN_GB_EMMA = 'Emma'; |
|
| 157 | + public const VOICE_EN_IN_ADITI = 'Aditi'; |
|
| 158 | + public const VOICE_EN_IN_RAVEENA = 'Raveena'; |
|
| 159 | + public const VOICE_DE_DE_HANS = 'Hans'; |
|
| 160 | + public const VOICE_DE_DE_MARLENE = 'Marlene'; |
|
| 161 | + public const VOICE_DE_DE_VICKI = 'Vicki'; |
|
| 162 | + public const VOICE_ES_ES_CONCHITA = 'Conchita'; |
|
| 163 | + public const VOICE_ES_ES_ENRIQUE = 'Enrique'; |
|
| 164 | + public const VOICE_IT_IT_CARLA = 'Carla'; |
|
| 165 | + public const VOICE_IT_IT_GIORGIO = 'Giorgio'; |
|
| 166 | + public const VOICE_JA_JP_MIZUKI = 'Mizuki'; |
|
| 167 | + public const VOICE_JA_JP_TAKUMI = 'Takumi'; |
|
| 168 | + public const VOICE_FR_FR_CELINE = 'Celine'; |
|
| 169 | + public const VOICE_FR_FR_LEA = 'Lea'; |
|
| 170 | + public const VOICE_FR_FR_MATHIEU = 'Mathieu'; |
|
| 171 | + public const VOICES = [ |
|
| 172 | + self::VOICE_EN_US_IVY, |
|
| 173 | + self::VOICE_EN_US_JOANNA, |
|
| 174 | + self::VOICE_EN_US_JOEY, |
|
| 175 | + self::VOICE_EN_US_JUSTIN, |
|
| 176 | + self::VOICE_EN_US_KENDRA, |
|
| 177 | + self::VOICE_EN_US_KIMBERLY, |
|
| 178 | + self::VOICE_EN_US_MATTHEW, |
|
| 179 | + self::VOICE_EN_US_SALLI, |
|
| 180 | + self::VOICE_EN_AU_RUSSELL, |
|
| 181 | + self::VOICE_EN_GB_AMY, |
|
| 182 | + self::VOICE_EN_GB_BRIAN, |
|
| 183 | + self::VOICE_EN_GB_EMMA, |
|
| 184 | + self::VOICE_EN_IN_ADITI, |
|
| 185 | + self::VOICE_EN_IN_RAVEENA, |
|
| 186 | + self::VOICE_DE_DE_HANS, |
|
| 187 | + self::VOICE_DE_DE_MARLENE, |
|
| 188 | + self::VOICE_DE_DE_VICKI, |
|
| 189 | + self::VOICE_ES_ES_CONCHITA, |
|
| 190 | + self::VOICE_ES_ES_ENRIQUE, |
|
| 191 | + self::VOICE_IT_IT_CARLA, |
|
| 192 | + self::VOICE_IT_IT_GIORGIO, |
|
| 193 | + self::VOICE_JA_JP_MIZUKI, |
|
| 194 | + self::VOICE_JA_JP_TAKUMI, |
|
| 195 | + self::VOICE_FR_FR_CELINE, |
|
| 196 | + self::VOICE_FR_FR_LEA, |
|
| 197 | + self::VOICE_FR_FR_MATHIEU, |
|
| 198 | + ]; |
|
| 199 | + public const INTERPRET_WORD_VB = 'amazon:VB'; |
|
| 200 | + public const INTERPRET_WORD_VBD = 'amazon:VBD'; |
|
| 201 | + public const INTERPRET_WORD_NN = 'amazon:NN'; |
|
| 202 | + public const INTERPRET_WORD_SENSE_1 = 'amazon:SENSE_1'; |
|
| 203 | + public const INTERPRET_WORDS = [ |
|
| 204 | + self::INTERPRET_WORD_VB, |
|
| 205 | + self::INTERPRET_WORD_VBD, |
|
| 206 | + self::INTERPRET_WORD_NN, |
|
| 207 | + self::INTERPRET_WORD_SENSE_1, |
|
| 208 | + ]; |
|
| 209 | 209 | } |