public function __construct(array $item, Account $account, Counts $counts, UserAttributes $userAttributes, bool $sensitive, Application $application, array $mentions, array $tags, Card $card, array $attachments, array $reblog)
{
$this->id = (string)$item['uri-id'];
- $this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::ATOM);
+ $this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::JSON);
if ($item['gravity'] == GRAVITY_COMMENT) {
$this->in_reply_to_id = (string)$item['thr-parent-id'];
$this->visibility = $visibility[$item['private']];
$languages = json_decode($item['language'], true);
- $this->language = is_array($languages) ? array_key_first($languages) : null;
+ if (is_array($languages)) {
+ reset($languages);
+ $this->language = key($languages);
+ } else {
+ $this->language = null;
+ }
$this->uri = $item['uri'];
$this->url = $item['plink'] ?? null;
$this->muted = $userAttributes->muted;
$this->bookmarked = $userAttributes->bookmarked;
$this->pinned = $userAttributes->pinned;
- $this->content = BBCode::convert($item['raw-body'] ?? $item['body'], false);
+ $this->content = BBCode::convert($item['raw-body'] ?? $item['body'], false, BBCode::API);
$this->reblog = $reblog;
$this->application = $application->toArray();
$this->account = $account->toArray();
$this->mentions = $mentions;
$this->tags = $tags;
$this->emojis = [];
- $this->card = $card->toArray();
+ $this->card = $card->toArray() ?: null;
$this->poll = null;
}