diff --git a/src/Response/Card/CardTypes.php b/src/Response/Card/CardTypes.php new file mode 100644 index 0000000..244ca12 --- /dev/null +++ b/src/Response/Card/CardTypes.php @@ -0,0 +1,19 @@ + self::CARD_TYPE + 'type' => CardTypes::TYPE_LINK_ACCOUNT ]; } } diff --git a/src/Response/Card/SimpleCard.php b/src/Response/Card/SimpleCard.php index 001d22d..1ec4e29 100644 --- a/src/Response/Card/SimpleCard.php +++ b/src/Response/Card/SimpleCard.php @@ -3,6 +3,7 @@ namespace Alexa\Response\Card; use Alexa\Response\Card\CardInterface; +use Alexa\Response\Card\CardTypes; /** * Class SimpleCard @@ -15,8 +16,6 @@ class SimpleCard implements CardInterface { // Constants - const CARD_TYPE = 'Simple'; - const ERROR_TITLE_NOT_SET = 'You must provide a title for the card'; const ERROR_CONTENT_NOT_SET = 'You must provide the content for the card'; @@ -55,7 +54,7 @@ public function __construct($title, $content) public function render() { return [ - 'type' => self::CARD_TYPE, + 'type' => CardTypes::TYPE_SIMPLE, 'title' => $this->getTitle(), 'content' => $this->getContent() ]; diff --git a/src/Response/Card/StandardCard.php b/src/Response/Card/StandardCard.php index d3a04d9..0a7e556 100644 --- a/src/Response/Card/StandardCard.php +++ b/src/Response/Card/StandardCard.php @@ -3,6 +3,7 @@ namespace Alexa\Response\Card; use Alexa\Response\Card\CardInterface; +use Alexa\Response\Card\CardTypes; /** * Class StandardCard @@ -15,8 +16,6 @@ class StandardCard implements CardInterface { // Constants - const CARD_TYPE = 'Standard'; - const ERROR_TITLE_NOT_SET = 'You must provide a title.'; const ERROR_TEXT_NOT_SET = 'You must provide card text.'; const ERROR_SMALL_IMAGE_URL_NOT_SET = 'You must provide a small image URL.'; @@ -67,7 +66,7 @@ public function __construct($title, $text, $smallImageUrl, $largeImageUrl) public function render() { return [ - 'type' => self::CARD_TYPE, + 'type' => CardTypes::TYPE_STANDARD, 'title' => $this->getTitle(), 'text' => $this->getText(), 'image' => [ diff --git a/src/Response/OutputSpeech/OutputSpeechTypes.php b/src/Response/OutputSpeech/OutputSpeechTypes.php new file mode 100644 index 0000000..4d6f531 --- /dev/null +++ b/src/Response/OutputSpeech/OutputSpeechTypes.php @@ -0,0 +1,18 @@ + self::OUTPUT_SPEECH_TYPE, + 'type' => OutputSpeechTypes::TYPE_PLAIN_TEXT, 'text' => $this->getText() ]; } diff --git a/src/Response/OutputSpeech/SsmlOutputSpeech.php b/src/Response/OutputSpeech/SsmlOutputSpeech.php index 1376e1c..48986f7 100644 --- a/src/Response/OutputSpeech/SsmlOutputSpeech.php +++ b/src/Response/OutputSpeech/SsmlOutputSpeech.php @@ -3,6 +3,7 @@ namespace Alexa\Response\OutputSpeech; use Alexa\Response\OutputSpeech\OutputSpeechInterface; +use Alexa\Response\OutputSpeech\OutputSpeechTypes; /** * Class SsmlOutputSpeech @@ -15,8 +16,6 @@ class SsmlOutputSpeech implements OutputSpeechInterface { // Constants - const OUTPUT_SPEECH_TYPE_SSML = 'SSML'; - const ERROR_SSML_NOT_SET = 'You must provide output speech SSML.'; // Fields @@ -46,7 +45,7 @@ public function __construct($ssml) public function render() { return [ - 'type' => self::OUTPUT_SPEECH_TYPE_SSML, + 'type' => OutputSpeechTypes::TYPE_SSML, 'ssml' => $this->getSsml() ]; }