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.
34 lines
667 B
34 lines
667 B
<?php
|
|
|
|
namespace WeWork\Message;
|
|
|
|
class MPNews implements ResponseMessageInterface
|
|
{
|
|
/**
|
|
* @var MPArticle[]
|
|
*/
|
|
private $articles;
|
|
|
|
/**
|
|
* @param MPArticle[] $articles
|
|
*/
|
|
public function __construct(array $articles)
|
|
{
|
|
$this->articles = $articles;
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function formatForResponse(): array
|
|
{
|
|
return [
|
|
'msgtype' => 'mpnews',
|
|
'mpnews' => [
|
|
'articles' => array_map(function (MPArticle $article) {
|
|
return $article->formatForResponse();
|
|
}, $this->articles)
|
|
]
|
|
];
|
|
}
|
|
}
|
|
|