當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Swift_Message::setDescription方法代碼示例

本文整理匯總了PHP中Swift_Message::setDescription方法的典型用法代碼示例。如果您正苦於以下問題:PHP Swift_Message::setDescription方法的具體用法?PHP Swift_Message::setDescription怎麽用?PHP Swift_Message::setDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Swift_Message的用法示例。


在下文中一共展示了Swift_Message::setDescription方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setDescription

 /**
  * {@inheritdoc}
  *
  * @return $this|self
  */
 public function setDescription($description) : self
 {
     $this->message->setDescription($description);
     return $this;
 }
開發者ID:cawaphp,項目名稱:email,代碼行數:10,代碼來源:Message.php

示例2: render

 /**
  * Render a message for the given recipient.
  *
  * @param RecipientInterface $recipient
  * @param array              $additionalData
  *
  * @return \Avisota\Message\MessageInterface
  * @internal param array $newsletterData Additional newsletter data.
  *
  * @internal param RecipientInterface $recipientEmail The main recipient.
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function render(RecipientInterface $recipient = null, array $additionalData = array())
 {
     /** @var EventDispatcher $eventDispatcher */
     $eventDispatcher = $GLOBALS['container']['event-dispatcher'];
     // dispatch a pre render event
     $event = new PreRenderMessageTemplateEvent($this->message, $this, $recipient, $additionalData);
     $eventDispatcher->dispatch($event::NAME, $event);
     // fetch updates on additional data
     $additionalData = $event->getAdditionalData();
     $content = $this->parseContent($recipient, $additionalData);
     $swiftMessage = new \Swift_Message();
     $name = trim($recipient->get('forename') . ' ' . $recipient->get('surname'));
     $swiftMessage->setTo($recipient->getEmail(), $name);
     $swiftMessage->setSubject($this->message->getSubject());
     $swiftMessage->setBody($content, $this->getContentType(), $this->getContentEncoding());
     $swiftMessage->setDescription($this->message->getDescription());
     if ($this->message->getAddFile()) {
         $files = deserialize($this->message->getFiles(), true);
         foreach ($files as $file) {
             $file = \Compat::resolveFile($file);
             if ($file) {
                 $attachment = \Swift_Attachment::fromPath(TL_ROOT . '/' . $file);
                 $swiftMessage->attach($attachment);
             }
         }
     }
     $message = new ContaoAwareNativeMessage($swiftMessage, $this->message, array($recipient));
     // dispatch a post render event
     $event = new PostRenderMessageTemplateEvent($this->message, $this, $recipient, $additionalData, $message);
     $eventDispatcher->dispatch($event::NAME, $event);
     return $message;
 }
開發者ID:avisota,項目名稱:contao-message,代碼行數:44,代碼來源:AbstractPostRenderingMessageTemplate.php


注:本文中的Swift_Message::setDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。