コード例 #1
0
 /**
  * Construct message ready for formatting and transmission.
  *
  * @param Message $message
  *
  * @return array
  */
 protected function buildMessage(Message $message)
 {
     $msg = array('service' => str_replace(" ", "", $message->getFrom()['name']), 'message' => $message->getBody());
     if (null !== $this->getIcon()) {
         $msg['icon_url'] = $this->getIcon();
     }
     if (null !== $message->getIcon()) {
         $msg['icon_url'] = $message->getIcon();
     }
     return $msg;
 }
コード例 #2
0
 /**
  * Construct message ready for formatting and transmission.
  *
  * @param Message $message
  *
  * @return array
  */
 protected function buildMessage(Message $message)
 {
     $msg = array('title' => $message->getFrom()['name'], 'message' => $message->getBody());
     if (null !== $this->getIcon()) {
         $msg['picture'] = $this->getIcon();
     }
     if (null !== $message->getIcon()) {
         $msg['picture'] = $message->getIcon();
     }
     return $msg;
 }
コード例 #3
0
 /**
  * Construct message ready for formatting and transmission.
  *
  * @param Message $message
  *
  * @return array
  */
 protected function buildMessage(Message $message)
 {
     $msg = array('text' => $message->getBody(), 'username' => $message->getFrom()['name']);
     if (null !== $this->getIcon()) {
         $msg['icon_url'] = $this->getIcon();
     }
     if (null !== $message->getIcon()) {
         $msg['icon_url'] = $message->getIcon();
     }
     if (null !== $this->channel) {
         $msg['channel'] = $this->channel;
     }
     return $msg;
 }
コード例 #4
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;
 }