]> git.mxchange.org Git - friendica.git/commitdiff
Fix codestyle
authorMichael <heluecht@pirati.ca>
Sat, 1 Mar 2025 14:40:50 +0000 (14:40 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 1 Mar 2025 14:40:50 +0000 (14:40 +0000)
src/Object/Api/Mastodon/Account.php
src/Object/Api/Mastodon/Card.php
src/Object/Api/Mastodon/Status.php

index 864b263ccaeffea076cb704d4b951e5ed7ff9d7b..b4009b6e69a6c57f102695932416f81b334114c1 100644 (file)
@@ -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();
        }
 
        /**
index 9b9c58db1bb373477ca6db7bceadb812eb66f608..0de3f9c499c1647cdd1188578df8756a2807cb75 100644 (file)
@@ -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;
index 16eba0afcb45a9a9e943e0882c156e7727902bf2..9f68d27d14a567c5d1c6107af9f990137fd3faae 100644 (file)
@@ -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;
        }
 
        /**