1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace WeWork\Message;
- class TextCard implements ResponseMessageInterface
- {
- /**
- * @var string
- */
- private $title;
- /**
- * @var string
- */
- private $description;
- /**
- * @var string
- */
- private $url;
- /**
- * @var string
- */
- private $btnTxt;
- /**
- * @param string $title
- * @param string $description
- * @param string $url
- * @param string $btnTxt
- */
- public function __construct(string $title, string $description, string $url, string $btnTxt = '')
- {
- $this->title = $title;
- $this->description = $description;
- $this->url = $url;
- $this->btnTxt = $btnTxt;
- }
- /**
- * @return array
- */
- public function formatForResponse(): array
- {
- return [
- 'msgtype' => 'textcard',
- 'textcard' => [
- 'title' => $this->title,
- 'description' => $this->description,
- 'url' => $this->url,
- 'btntxt' => $this->btnTxt
- ]
- ];
- }
- }
|