*/
public function __construct(BaseURL $baseUrl, array $account, Fields $fields)
{
- $this->id = (string)$account['pid'];
- $this->username = $account['nick'];
- $this->acct =
- strpos($account['url'], $baseUrl . '/') === 0 ?
+ $this->id = (string)$account['pid'];
+ $this->username = $account['nick'];
+ $this->acct = strpos($account['url'], $baseUrl . '/') === 0 ?
$account['nick'] :
$account['addr'];
- $this->display_name = $account['name'];
- $this->locked = (bool)$account['manually-approve'];
- $this->bot = ($account['contact-type'] == Contact::TYPE_NEWS);
- $this->discoverable = !$account['unsearchable'];
- $this->indexable = $this->discoverable;
- $this->group = ($account['contact-type'] == Contact::TYPE_COMMUNITY);
+ $this->display_name = $account['name'];
+ $this->locked = (bool)$account['manually-approve'];
+ $this->bot = ($account['contact-type'] == Contact::TYPE_NEWS);
+ $this->discoverable = !$account['unsearchable'];
+ $this->indexable = $this->discoverable;
+ $this->group = ($account['contact-type'] == Contact::TYPE_COMMUNITY);
- $this->created_at = DateTimeFormat::utc($account['created'] ?: DBA::NULL_DATETIME, DateTimeFormat::JSON);
+ $this->created_at = DateTimeFormat::utc($account['created'] ?: DBA::NULL_DATETIME, DateTimeFormat::JSON);
$this->note = BBCode::convertForUriId($account['uri-id'], $account['about'], BBCode::EXTERNAL);
$this->url = $account['alias'] ?: $account['url'];
$this->header_static = Contact::getHeaderUrlForId($account['id'] ?? 0 ?: $account['pid'], '', $account['updated'], $account['guid'] ?? '', true);
$this->followers_count = $account['ap-followers_count'] ?? $account['diaspora-interacted_count'] ?? 0;
$this->following_count = $account['ap-following_count'] ?? $account['diaspora-interacting_count'] ?? 0;
- $this->statuses_count = $account['ap-statuses_count'] ?? $account['diaspora-post_count'] ?? 0;
+ $this->statuses_count = $account['ap-statuses_count'] ?? $account['diaspora-post_count'] ?? 0;
- $lastItem = $account['last-item'] ? DateTimeFormat::utc($account['last-item'], 'Y-m-d') : DBA::NULL_DATETIME;
- $this->last_status_at = $lastItem != DBA::NULL_DATETIME ? DateTimeFormat::utc($lastItem, DateTimeFormat::JSON) : null;
+ $lastItem = $account['last-item'] ? DateTimeFormat::utc($account['last-item'], 'Y-m-d') : DBA::NULL_DATETIME;
+ $this->last_status_at = $lastItem != DBA::NULL_DATETIME ? DateTimeFormat::utc($lastItem, DateTimeFormat::JSON) : null;
// No custom emojis per account in Friendica
- $this->emojis = [];
- $this->fields = $fields->getArrayCopy();
+ $this->emojis = [];
+ $this->fields = $fields->getArrayCopy();
}
/**
*/
public function __construct(array $attachment, array $history = [])
{
- $this->url = $attachment['url'] ?? '';
- $this->title = $attachment['title'] ?? '';
- $this->description = $attachment['description'] ?? '';
- $this->type = $attachment['type'] ?? '';
- $this->author_name = $attachment['author_name'] ?? '';
- $this->author_url = $attachment['author_url'] ?? '';
+ $this->url = $attachment['url'] ?? '';
+ $this->title = $attachment['title'] ?? '';
+ $this->description = $attachment['description'] ?? '';
+ $this->type = $attachment['type'] ?? '';
+ $this->author_name = $attachment['author_name'] ?? '';
+ $this->author_url = $attachment['author_url'] ?? '';
$this->provider_name = $attachment['provider_name'] ?? '';
- $this->provider_url = $attachment['provider_url'] ?? '';
+ $this->provider_url = $attachment['provider_url'] ?? '';
$this->html = '';
- $this->width = $attachment['width'] ?? 0;
+ $this->width = $attachment['width'] ?? 0;
$this->height = $attachment['height'] ?? 0;
- $this->image = $attachment['image'] ?? '';
+ $this->image = $attachment['image'] ?? '';
$this->embed_url = '';
$this->blurhash = $attachment['blurhash'] ?? '';
$this->history = $history;
*/
public function __construct(array $item, Account $account, Counts $counts, UserAttributes $userAttributes, bool $sensitive, Application $application, array $mentions, array $tags, Card $card, array $attachments, array $in_reply, array $reblog, FriendicaExtension $friendica, array $quote = null, array $poll = null, array $emojis = null)
{
- $reblogged = !empty($reblog);
- $this->id = (string)$item['uri-id'];
- $this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::JSON);
- $this->edited_at = DateTimeFormat::utc($item['edited'], DateTimeFormat::JSON);
+ $reblogged = !empty($reblog);
+ $this->id = (string)$item['uri-id'];
+ $this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::JSON);
+ $this->edited_at = DateTimeFormat::utc($item['edited'], DateTimeFormat::JSON);
if ($item['gravity'] == Item::GRAVITY_COMMENT) {
$this->in_reply_to_id = (string)$item['thr-parent-id'];
$this->sensitive = $sensitive;
$this->spoiler_text = $item['title'] ?: $item['content-warning'] ?: '';
- $visibility = ['public', 'private', 'unlisted'];
+ $visibility = ['public', 'private', 'unlisted'];
$this->visibility = $visibility[$item['private']];
$languages = json_decode($item['language'] ?? '', true);
$this->language = null;
}
- $this->uri = $item['uri'];
- $this->url = $item['plink'] ?? null;
- $this->replies_count = $reblogged ? 0 : $counts->replies;
- $this->reblogs_count = $reblogged ? 0 : $counts->reblogs;
- $this->favourites_count = $reblogged ? 0 : $counts->favourites;
- $this->favourited = $userAttributes->favourited;
- $this->reblogged = $userAttributes->reblogged;
- $this->muted = $userAttributes->muted;
- $this->bookmarked = $userAttributes->bookmarked;
- $this->pinned = $userAttributes->pinned;
- $this->content = $reblogged ? '' : BBCode::convertForUriId($item['uri-id'], BBCode::setMentionsToNicknames($item['raw-body'] ?? $item['body']), BBCode::MASTODON_API);
- $this->reblog = $reblog;
- $this->quote = $quote;
- $this->application = $application->toArray();
- $this->account = $account->toArray();
+ $this->uri = $item['uri'];
+ $this->url = $item['plink'] ?? null;
+ $this->replies_count = $reblogged ? 0 : $counts->replies;
+ $this->reblogs_count = $reblogged ? 0 : $counts->reblogs;
+ $this->favourites_count = $reblogged ? 0 : $counts->favourites;
+ $this->favourited = $userAttributes->favourited;
+ $this->reblogged = $userAttributes->reblogged;
+ $this->muted = $userAttributes->muted;
+ $this->bookmarked = $userAttributes->bookmarked;
+ $this->pinned = $userAttributes->pinned;
+ $this->content = $reblogged ? '' : BBCode::convertForUriId($item['uri-id'], BBCode::setMentionsToNicknames($item['raw-body'] ?? $item['body']), BBCode::MASTODON_API);
+ $this->reblog = $reblog;
+ $this->quote = $quote;
+ $this->application = $application->toArray();
+ $this->account = $account->toArray();
$this->media_attachments = $reblogged ? [] : $attachments;
- $this->mentions = $reblogged ? [] : $mentions;
- $this->tags = $reblogged ? [] : $tags;
- $this->emojis = $reblogged ? [] : ($emojis ?: []);
- $this->card = $reblogged ? null : ($card->toArray() ?: null);
- $this->poll = $reblogged ? null : $poll;
- $this->friendica = $reblogged ? null : $friendica;
+ $this->mentions = $reblogged ? [] : $mentions;
+ $this->tags = $reblogged ? [] : $tags;
+ $this->emojis = $reblogged ? [] : ($emojis ?: []);
+ $this->card = $reblogged ? null : ($card->toArray() ?: null);
+ $this->poll = $reblogged ? null : $poll;
+ $this->friendica = $reblogged ? null : $friendica;
}
/**