diff --git a/src/Model/Step/Message.php b/src/Model/Step/Message.php index 64581ff..ad83a46 100644 --- a/src/Model/Step/Message.php +++ b/src/Model/Step/Message.php @@ -11,15 +11,22 @@ class Message extends AbstractStep */ private $message; + /** + * @var array + */ + private $quickreplies; + /** * @param string $message * @param float $confidence * @param array $entities + * @param array $quickreplies */ - public function __construct($message, $confidence, array $entities = []) + public function __construct($message, $confidence, array $entities = [], array $quickreplies = []) { - parent::__construct(Step::TYPE_MESSAGE, $confidence, $entities); + parent::__construct(Step::TYPE_MESSAGE, $confidence, $entities, $quickreplies); $this->message = $message; + $this->quickreplies = $quickreplies; } /** @@ -29,4 +36,12 @@ public function getMessage() { return $this->message; } -} + + /** + * @return array + */ + public function getQuickReplies() + { + return $this->quickreplies; + } +} \ No newline at end of file diff --git a/src/StepFactory.php b/src/StepFactory.php index 9ed1dae..e4753a0 100644 --- a/src/StepFactory.php +++ b/src/StepFactory.php @@ -39,6 +39,16 @@ private static function getEntitiesFromStepData(array $step = []) return isset($step['entities']) ? $step['entities'] : []; } + /** + * @param array $step + * + * @return array + */ + private static function getQuickRepliesFromStepData(array $step = []) + { + return isset($step['quickreplies']) ? $step['quickreplies'] : []; + } + /** * @param array $step * @@ -66,7 +76,7 @@ public static function createMergeStep(array $step) */ public static function createMessageStep(array $step) { - return new Message($step['msg'], $step['confidence'], self::getEntitiesFromStepData($step)); + return new Message($step['msg'], $step['confidence'], self::getEntitiesFromStepData($step), self::getQuickRepliesFromStepData($step)); } /** @@ -78,4 +88,4 @@ public static function createStopStep(array $step) { return new Stop($step['confidence']); } -} +} \ No newline at end of file