You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.1 KiB
56 lines
1.1 KiB
<?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
|
|
]
|
|
];
|
|
}
|
|
}
|
|
|