MPArticle.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace WeWork\Message;
  3. class MPArticle implements ResponseMessageInterface
  4. {
  5. /**
  6. * @var string
  7. */
  8. private $title;
  9. /**
  10. * @var string
  11. */
  12. private $thumbMediaId;
  13. /**
  14. * @var string
  15. */
  16. private $author;
  17. /**
  18. * @var string
  19. */
  20. private $contentSourceUrl;
  21. /**
  22. * @var string
  23. */
  24. private $content;
  25. /**
  26. * @var string
  27. */
  28. private $digest;
  29. /**
  30. * @param string $title
  31. * @param string $thumbMediaId
  32. * @param string $content
  33. * @param string $author
  34. * @param string $contentSourceUrl
  35. * @param string $digest
  36. */
  37. public function __construct(string $title, string $thumbMediaId, string $content, string $author = '', string $contentSourceUrl = '', string $digest = '')
  38. {
  39. $this->title = $title;
  40. $this->thumbMediaId = $thumbMediaId;
  41. $this->content = $content;
  42. $this->author = $author;
  43. $this->contentSourceUrl = $contentSourceUrl;
  44. $this->digest = $digest;
  45. }
  46. /**
  47. * @return array
  48. */
  49. public function formatForResponse(): array
  50. {
  51. return [
  52. 'title' => $this->title,
  53. 'thumb_media_id' => $this->thumbMediaId,
  54. 'author' => $this->author,
  55. 'content_source_url' => $this->contentSourceUrl,
  56. 'content' => $this->content,
  57. 'digest' => $this->digest
  58. ];
  59. }
  60. }