Text.php 786 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace WeWork\Message;
  3. class Text implements ResponseMessageInterface, ReplyMessageInterface
  4. {
  5. /**
  6. * @var string
  7. */
  8. private $content;
  9. /**
  10. * @param string $content
  11. */
  12. public function __construct(string $content)
  13. {
  14. $this->content = $content;
  15. }
  16. /**
  17. * @return array
  18. */
  19. public function formatForReply(): array
  20. {
  21. return [
  22. 'MsgType' => 'text',
  23. 'Content' => $this->content
  24. ];
  25. }
  26. /**
  27. * @return array
  28. */
  29. public function formatForResponse(): array
  30. {
  31. return [
  32. 'msgtype' => 'text',
  33. 'text' => [
  34. 'content' => $this->content
  35. ]
  36. ];
  37. }
  38. }