Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/Model/Step/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -29,4 +36,12 @@ public function getMessage()
{
return $this->message;
}
}

/**
* @return array
*/
public function getQuickReplies()
{
return $this->quickreplies;
}
}
14 changes: 12 additions & 2 deletions src/StepFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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));
}

/**
Expand All @@ -78,4 +88,4 @@ public static function createStopStep(array $step)
{
return new Stop($step['confidence']);
}
}
}