No Description

MessagePropertiesForPublish.php 976B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace AliyunMNS\Traits;
  3. use AliyunMNS\Constants;
  4. use AliyunMNS\Model\MessageAttributes;
  5. trait MessagePropertiesForPublish
  6. {
  7. public $messageBody;
  8. public $messageAttributes;
  9. public function getMessageBody()
  10. {
  11. return $this->messageBody;
  12. }
  13. public function setMessageBody($messageBody)
  14. {
  15. $this->messageBody = $messageBody;
  16. }
  17. public function getMessageAttributes()
  18. {
  19. return $this->messageAttributes;
  20. }
  21. public function setMessageAttributes($messageAttributes)
  22. {
  23. $this->messageAttributes = $messageAttributes;
  24. }
  25. public function writeMessagePropertiesForPublishXML(\XMLWriter $xmlWriter)
  26. {
  27. if ($this->messageBody != NULL)
  28. {
  29. $xmlWriter->writeElement(Constants::MESSAGE_BODY, $this->messageBody);
  30. }
  31. if ($this->messageAttributes !== NULL)
  32. {
  33. $this->messageAttributes->writeXML($xmlWriter);
  34. }
  35. }
  36. }
  37. ?>