mirror of
https://github.com/friendica/friendica
synced 2025-03-11 17:08:25 +00:00
Fix codestyle
This commit is contained in:
parent
fb9a20feaa
commit
1ced848827
3 changed files with 50 additions and 51 deletions
|
@ -84,20 +84,19 @@ class Account extends BaseDataTransferObject
|
|||
*/
|
||||
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'];
|
||||
|
@ -108,14 +107,14 @@ class Account extends BaseDataTransferObject
|
|||
$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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -61,18 +61,18 @@ class Card extends BaseDataTransferObject
|
|||
*/
|
||||
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;
|
||||
|
|
|
@ -97,10 +97,10 @@ class Status extends BaseDataTransferObject
|
|||
*/
|
||||
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'];
|
||||
|
@ -111,7 +111,7 @@ class Status extends BaseDataTransferObject
|
|||
$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);
|
||||
|
@ -122,28 +122,28 @@ class Status extends BaseDataTransferObject
|
|||
$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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue