/**
  * Construct message ready for formatting and transmission.
  *
  * @param Message $message
  *
  * @return array
  */
 protected function buildMessage(Message $message)
 {
     $msg = array('external_user_name' => str_replace(" ", "", $message->getFrom()['name']), 'content' => $message->getBody());
     $tags = $message->getTags();
     if (is_array($this->tags) && !empty($this->tags)) {
         $tags = array_merge($tags, $this->tags);
     }
     if (!empty($tags)) {
         $msg['tags'] = $tags;
     }
     return $msg;
 }
Esempio n. 2
0
 /**
  * Construct message ready for formatting and transmission.
  *
  * @param Message $message
  *
  * @return string
  */
 protected function buildMessage(Message $message)
 {
     $from = $message->getFrom();
     $content = $message->getBody();
     $tags = $message->getTags();
     $icon = $message->getIcon();
     $string = (string) "[MESSENGER] : A message has been sent." . PHP_EOL;
     $string .= "[MESSENGER][FROM] : {$from['name']}" . ($from['email'] != "" ? "[{$from['email']}]" : "") . PHP_EOL;
     $string .= "[MESSENGER][CONTENT] : {$content}";
     if (!empty($tags) && is_array($tags)) {
         $string .= PHP_EOL . "[MESSENGER][TAGS] : " . implode(", ", $tags);
     }
     if (!is_null($icon)) {
         $string .= PHP_EOL . "[MESSENGER][ICON] : " . $icon;
     }
     return $string;
 }