]> git.mxchange.org Git - friendica.git/commitdiff
Fix code style
authorArt4 <art4@wlabs.de>
Mon, 17 Mar 2025 07:38:53 +0000 (07:38 +0000)
committerArt4 <art4@wlabs.de>
Mon, 17 Mar 2025 07:38:53 +0000 (07:38 +0000)
18 files changed:
src/Console/PoToPhp.php
src/Contact/Introduction/Repository/Introduction.php
src/Content/Conversation/Repository/UserDefinedChannel.php
src/Content/Post/Entity/PostMedia.php
src/Content/Post/Repository/PostMedia.php
src/Core/Hook.php
src/Database/Database.php
src/Factory/Api/Mastodon/Attachment.php
src/Factory/Api/Twitter/Status.php
src/Module/Filer/RemoveTag.php
src/Navigation/Notifications/Repository/Notification.php
src/Navigation/Notifications/ValueObject/Introduction.php
src/Network/HTTPClient/Response/CurlResult.php
src/Object/Api/Friendica/Notification.php
src/Object/Api/Mastodon/Field.php
src/Protocol/Diaspora/Repository/DiasporaContact.php
src/Security/PermissionSet/Repository/PermissionSet.php
src/Security/Security.php

index a99cd6e8064c464b30292a0f2b52030d102373ab..480da23c46d71482f6da0d9c01bcaae7411b6b6e 100644 (file)
@@ -134,7 +134,7 @@ HELP;
                );
 
                $fnname = 'string_plural_select_' . $lang;
-               $out = 'if(! function_exists("' . $fnname . '")) {' . "\n";
+               $out    = 'if(! function_exists("' . $fnname . '")) {' . "\n";
                $out .= 'function ' . $fnname . '($n){' . "\n";
                $out .= '       $n = intval($n);' . "\n";
                $out .= '       ' . $return . "\n";
@@ -192,13 +192,13 @@ HELP;
 
                if ($q === false || $s < $q) {
                        list($then, $else) = explode(':', $string, 2);
-                       $node['then'] = $then;
-                       $parsedElse = [];
+                       $node['then']      = $then;
+                       $parsedElse        = [];
                        self::parse($else, $parsedElse);
                        $node['else'] = $parsedElse;
                } else {
                        list($if, $thenelse) = explode('?', $string, 2);
-                       $node['if'] = $if;
+                       $node['if']          = $if;
                        self::parse($thenelse, $node);
                }
        }
@@ -214,7 +214,7 @@ HELP;
        private static function render($tree): string
        {
                if (is_array($tree)) {
-                       $if = trim($tree['if']);
+                       $if   = trim($tree['if']);
                        $then = trim($tree['then']);
                        $else = self::render($tree['else']);
 
index dec2f2a246d24c0fc58f31efc6ef217b9fa350e2..a624017a2a188298a6996800fe8b82fa977ed28c 100644 (file)
@@ -83,7 +83,10 @@ class Introduction extends BaseRepository
                        $BaseCollection = parent::_selectByBoundaries(
                                ['`uid` = ? AND NOT `ignore`',$uid],
                                ['order' => ['id' => 'DESC']],
-                               $min_id, $max_id, $limit);
+                               $min_id,
+                               $max_id,
+                               $limit
+                       );
                } catch (\Exception $e) {
                        throw new IntroductionPersistenceException(sprintf('Cannot select Introductions for used %d', $uid), $e);
                }
index b9eecbf53cd34fde349a9bebd5358109d64219e5..b256e34e561cbd7c1fdc5ffe645d266220a3dc32 100644 (file)
@@ -169,14 +169,14 @@ class UserDefinedChannel extends BaseRepository
                $uids = array_column($users, 'uid');
 
                $usercondition = ['uid' => $uids];
-               $condition = DBA::mergeConditions($usercondition, ["`languages` != ? AND `include-tags` = ? AND `full-text-search` = ? AND `circle` = ?", '', '', '', 0]);
+               $condition     = DBA::mergeConditions($usercondition, ["`languages` != ? AND `include-tags` = ? AND `full-text-search` = ? AND `circle` = ?", '', '', '', 0]);
                foreach ($this->select($condition) as $channel) {
                        if (!empty($channel->languages) && in_array($language, $channel->languages)) {
                                return true;
                        }
                }
 
-               $search = '';
+               $search    = '';
                $condition = DBA::mergeConditions($usercondition, ["`full-text-search` != ? AND `circle` = ? AND `valid`", '', 0]);
                foreach ($this->select($condition) as $channel) {
                        $search .= '(' . $channel->fullTextSearch . ') ';
@@ -201,7 +201,7 @@ class UserDefinedChannel extends BaseRepository
        {
                $condition = $this->getUserCondition();
                $condition = DBA::mergeConditions($condition, ["`account-type` IN (?, ?) AND `uid` != ?", User::ACCOUNT_TYPE_RELAY, User::ACCOUNT_TYPE_COMMUNITY, 0]);
-               $users = $this->db->selectToArray('user', ['uid'], $condition);
+               $users     = $this->db->selectToArray('user', ['uid'], $condition);
                if (empty($users)) {
                        return [];
                }
index 59d1ec9c57cfedf472cf039a9db7491f2a372909..b06e258710e0038bf636dc1c177958bb2ac6398f 100644 (file)
@@ -121,8 +121,7 @@ class PostMedia extends BaseEntity
                ?UriInterface $publisherImage = null,
                ?string $blurhash = null,
                int $id = null
-       )
-       {
+       ) {
                $this->uriId          = $uriId;
                $this->url            = $url;
                $this->type           = $type;
@@ -223,8 +222,8 @@ class PostMedia extends BaseEntity
 
                if ($newWidth && $newHeight && $size) {
                        $dimensionts = Images::getScalingDimensions($newWidth, $newHeight, Proxy::getPixelsFromSize($size));
-                       $newWidth = $dimensionts['width'];
-                       $newHeight = $dimensionts['height'];
+                       $newWidth    = $dimensionts['width'];
+                       $newHeight   = $dimensionts['height'];
                }
 
                return new self(
index 9d6b09cb5ffb8a1b33705bfddd7c1c2bb898dd29..d28d15bca734f2ea800109ded21b620fdf9de788 100644 (file)
@@ -167,7 +167,7 @@ class PostMedia extends BaseRepository
                                        // Peertube videos are delivered in many different resolutions. We pick a moderate one.
                                        // Since only Peertube provides a "height" parameter, this wouldn't be executed
                                        // when someone for example on Mastodon was sharing multiple videos in a single post.
-                                       $heights[$PostMedia->height] = (string)$PostMedia->url;
+                                       $heights[$PostMedia->height]     = (string)$PostMedia->url;
                                        $video[(string) $PostMedia->url] = $PostMedia;
                                } else {
                                        $attachments['visual'][] = $PostMedia;
index 8c9f3ba91018ba3c79608bf2a34fa96621180cc9..555b6b5d9f54b766a057993c57a9acf11eac312c 100644 (file)
@@ -40,7 +40,7 @@ class Hook
        public static function loadHooks()
        {
                self::$hooks = [];
-               $stmt = DBA::select('hook', ['hook', 'file', 'function'], [], ['order' => ['priority' => 'desc', 'file']]);
+               $stmt        = DBA::select('hook', ['hook', 'file', 'function'], [], ['order' => ['priority' => 'desc', 'file']]);
 
                while ($hook = DBA::fetch($stmt)) {
                        self::add($hook['hook'], $hook['file'], $hook['function']);
index 6f42756302eecc6a879eb7a8a5e2d7ddb9a4424e..88aa636fd34ff6c11bebc61dcc110b3eb8d62e8a 100644 (file)
@@ -62,15 +62,15 @@ class Database
        protected $server_info = '';
        /** @var PDO|mysqli|null */
        protected $connection;
-       protected $driver = '';
+       protected $driver               = '';
        protected $pdo_emulate_prepares = false;
-       private $error = '';
-       private $errorno = 0;
-       private $affected_rows = 0;
-       protected $in_transaction = false;
-       protected $in_retrial = false;
-       protected $testmode = false;
-       private $relation = [];
+       private $error                  = '';
+       private $errorno                = 0;
+       private $affected_rows          = 0;
+       protected $in_transaction       = false;
+       protected $in_retrial           = false;
+       protected $testmode             = false;
+       private $relation               = [];
        /** @var DbaDefinition */
        protected $dbaDefinition;
        /** @var ViewDefinition */
@@ -86,7 +86,7 @@ class Database
                $this->viewDefinition = $viewDefinition;
 
                // Use dummy values - necessary for the first factory call of the logger itself
-               $this->logger = new NullLogger();
+               $this->logger   = new NullLogger();
                $this->profiler = new Profiler($config);
 
                $this->connect();
@@ -630,7 +630,7 @@ class Database
                                        } elseif (is_string($args[$param])) {
                                                $param_types .= 's';
                                        } elseif (is_object($args[$param]) && method_exists($args[$param], '__toString')) {
-                                               $param_types  .= 's';
+                                               $param_types .= 's';
                                                $args[$param] = (string)$args[$param];
                                        } else {
                                                $param_types .= 'b';
@@ -677,9 +677,9 @@ class Database
                        }
 
                        $this->logger->error('DB Error', [
-                               'code'      => $errorno,
-                               'error'     => $error,
-                               'params'    => $this->replaceParameters($sql, $args),
+                               'code'   => $errorno,
+                               'error'  => $error,
+                               'params' => $this->replaceParameters($sql, $args),
                        ]);
 
                        // On a lost connection we try to reconnect - but only once.
@@ -784,9 +784,9 @@ class Database
                        }
 
                        $this->logger->error('DB Error', [
-                               'code'      => $errorno,
-                               'error'     => $error,
-                               'params'    => $this->replaceParameters($sql, $params),
+                               'code'   => $errorno,
+                               'error'  => $error,
+                               'params' => $this->replaceParameters($sql, $params),
                        ]);
 
                        // On a lost connection we simply quit.
@@ -1335,7 +1335,7 @@ class Database
                        return true;
                }
 
-               $fields = $this->castFields($table, $fields);
+               $fields        = $this->castFields($table, $fields);
                $direct_fields = [];
 
                foreach ($fields as $key => $value) {
index bd16b61b38a7851fc44ffd8c8906523e679ab70b..65eeec22ebdc4a09833a8e0ae6aaccb3eff0194e 100644 (file)
@@ -65,7 +65,7 @@ class Attachment extends BaseFactory
         * @return \Friendica\Object\Api\Mastodon\Attachment
         * @throws InternalServerErrorException
         */
-       private function createFromMediaArray(array $attachment):  \Friendica\Object\Api\Mastodon\Attachment
+       private function createFromMediaArray(array $attachment): \Friendica\Object\Api\Mastodon\Attachment
        {
                $filetype = !empty($attachment['mimetype']) ? strtolower(substr($attachment['mimetype'], 0, strpos($attachment['mimetype'], '/'))) : '';
 
index b77ee801f777456354559d8782faffd129d204c3..7d235cc870d9b25e1732a7abb926aeda17c6b39e 100644 (file)
@@ -111,7 +111,7 @@ class Status extends BaseFactory
         */
        private function createFromArray(array $item, int $uid, bool $include_entities): \Friendica\Object\Api\Twitter\Status
        {
-               $item = Post\Media::addHTMLAttachmentToItem($item);
+               $item   = Post\Media::addHTMLAttachmentToItem($item);
                $author = $this->twitterUser->createFromContactId($item['author-id'], $uid, true);
 
                if (!empty($item['causer-id']) && ($item['post-reason'] == Item::PR_ANNOUNCEMENT)) {
@@ -203,6 +203,6 @@ class Status extends BaseFactory
                        $entities = [];
                }
 
-               return new \Friendica\Object\Api\Twitter\Status($text, $statusnetHtml, $friendicaHtml, $item, $author, $owner, $retweeted, $quoted, $geo, $friendica_activities, $entities, $attachments,  $friendica_comments, $liked);
+               return new \Friendica\Object\Api\Twitter\Status($text, $statusnetHtml, $friendicaHtml, $item, $author, $owner, $retweeted, $quoted, $geo, $friendica_activities, $entities, $attachments, $friendica_comments, $liked);
        }
 }
index 28666c8a44059bede1806a767486ae7b21b92be5..eb20efe0bb3c9a3b3f8453f2773c7417949293ab 100644 (file)
@@ -71,7 +71,7 @@ class RemoveTag extends BaseModule
                $item_id = $this->parameters['id'] ?? 0;
 
                $term = trim($request['term'] ?? '');
-               $cat = trim($request['cat'] ?? '');
+               $cat  = trim($request['cat'] ?? '');
 
                if (!empty($cat)) {
                        $type = Post\Category::CATEGORY;
index 49703bc1f97c5581300587cd7019913a9c6f7725..85c889513508cb0a96c5a0dbec89d7412c2daec9 100644 (file)
@@ -127,23 +127,23 @@ class Notification extends BaseRepository
                $values = [$uid];
 
                $type_condition = '';
-               $notify_type = $this->pconfig->get($uid, 'system', 'notify_type');
+               $notify_type    = $this->pconfig->get($uid, 'system', 'notify_type');
                if (!is_null($notify_type)) {
                        $type_condition = 'AND `type` & ? != 0';
-                       $values[] = $notify_type | UserNotification::TYPE_SHARED | UserNotification::TYPE_FOLLOW;
+                       $values[]       = $notify_type | UserNotification::TYPE_SHARED | UserNotification::TYPE_FOLLOW;
                }
 
                $like_condition = '';
                if (!$this->pconfig->get($uid, 'system', 'notify_like')) {
                        $like_condition = 'AND NOT `vid` IN (?, ?)';
-                       $values[] = Verb::getID(Activity::LIKE);
-                       $values[] = Verb::getID(Activity::DISLIKE);
+                       $values[]       = Verb::getID(Activity::LIKE);
+                       $values[]       = Verb::getID(Activity::DISLIKE);
                }
 
                $announce_condition = '';
                if (!$this->pconfig->get($uid, 'system', 'notify_announce')) {
                        $announce_condition = 'AND vid != ?';
-                       $values[] = Verb::getID(Activity::ANNOUNCE);
+                       $values[]           = Verb::getID(Activity::ANNOUNCE);
                }
 
                $rows = $this->db->p("
@@ -253,12 +253,12 @@ class Notification extends BaseRepository
        public function deleteForItem(int $itemUriId): bool
        {
                $conditionTarget = [
-                       'vid' => Verb::getID(Activity::POST),
+                       'vid'           => Verb::getID(Activity::POST),
                        'target-uri-id' => $itemUriId,
                ];
 
                $conditionParent = [
-                       'vid' => Verb::getID(Activity::POST),
+                       'vid'           => Verb::getID(Activity::POST),
                        'parent-uri-id' => $itemUriId,
                ];
 
index 6e2c24d340401a2db2a10926724e33999358d56f..36e490d0bee5c96d8dbb22dcb3abe434dbaddb44 100644 (file)
@@ -63,30 +63,30 @@ class Introduction implements \JsonSerializable
 
        public function __construct(array $data = [])
        {
-               $this->label         = $data['label'] ?? '';
-               $this->type          = $data['str_type'] ?? '';
-               $this->intro_id      = $data['intro_id'] ?? -1;
-               $this->madeBy        = $data['madeBy'] ?? '';
-               $this->madeByUrl     = $data['madeByUrl'] ?? '';
-               $this->madeByZrl     = $data['madeByZrl'] ?? '';
-               $this->madeByAddr    = $data['madeByAddr'] ?? '';
-               $this->contactId     = $data['contactId'] ?? -1;
-               $this->photo         = $data['photo'] ?? '';
-               $this->name          = $data['name'] ?? '';
-               $this->url           = $data['url'] ?? '';
-               $this->zrl           = $data['zrl'] ?? '';
-               $this->hidden        = $data['hidden'] ?? false;
+               $this->label         = $data['label']         ?? '';
+               $this->type          = $data['str_type']      ?? '';
+               $this->intro_id      = $data['intro_id']      ?? -1;
+               $this->madeBy        = $data['madeBy']        ?? '';
+               $this->madeByUrl     = $data['madeByUrl']     ?? '';
+               $this->madeByZrl     = $data['madeByZrl']     ?? '';
+               $this->madeByAddr    = $data['madeByAddr']    ?? '';
+               $this->contactId     = $data['contactId']     ?? -1;
+               $this->photo         = $data['photo']         ?? '';
+               $this->name          = $data['name']          ?? '';
+               $this->url           = $data['url']           ?? '';
+               $this->zrl           = $data['zrl']           ?? '';
+               $this->hidden        = $data['hidden']        ?? false;
                $this->postNewFriend = $data['postNewFriend'] ?? '';
-               $this->knowYou       = $data['knowYou'] ?? false;
-               $this->note          = $data['note'] ?? '';
-               $this->request       = $data['request'] ?? '';
+               $this->knowYou       = $data['knowYou']       ?? false;
+               $this->note          = $data['note']          ?? '';
+               $this->request       = $data['request']       ?? '';
                $this->dfrnId        = -1;
-               $this->addr          = $data['addr'] ?? '';
-               $this->network       = $data['network'] ?? '';
-               $this->uid           = $data['uid'] ?? -1;
+               $this->addr          = $data['addr']     ?? '';
+               $this->network       = $data['network']  ?? '';
+               $this->uid           = $data['uid']      ?? -1;
                $this->keywords      = $data['keywords'] ?? '';
                $this->location      = $data['location'] ?? '';
-               $this->about         = $data['about'] ?? '';
+               $this->about         = $data['about']    ?? '';
        }
 
        public function getLabel(): string
index 30b8be38304cfb45bdfd72b0dc888bf6fa0e5d2d..a38de013364e95a9c9da367b21221d4318bedddd 100644 (file)
@@ -225,11 +225,11 @@ class CurlResult implements ICanHandleHttpResponses
                                }
                        }
 
-                       $this->redirectUrl = (string)Uri::fromParts((array)$redirect_parts);
-                       $this->isRedirectUrl = true;
+                       $this->redirectUrl         = (string)Uri::fromParts((array)$redirect_parts);
+                       $this->isRedirectUrl       = true;
                        $this->redirectIsPermanent = $this->returnCode == 301 || $this->returnCode == 308;
                } else {
-                       $this->isRedirectUrl = false;
+                       $this->isRedirectUrl       = false;
                        $this->redirectIsPermanent = false;
                }
        }
index f83cd9cc2cc96e4c966444c63d6a93fcb3a97d20..2a49ea770ca3ed24def86c848269412f09284913 100644 (file)
@@ -84,15 +84,15 @@ class Notification extends BaseDataTransferObject
                $this->date_rel   = Temporal::getRelativeDate($this->date);
 
                try {
-                       $this->msg_html  = BBCode::convertForUriId($notify->uriId, $this->msg, BBCode::EXTERNAL);
+                       $this->msg_html = BBCode::convertForUriId($notify->uriId, $this->msg, BBCode::EXTERNAL);
                } catch (\Exception $e) {
-                       $this->msg_html  = '';
+                       $this->msg_html = '';
                }
 
                try {
                        $this->msg_plain = explode("\n", trim(HTML::toPlaintext($this->msg_html, 0)))[0];
                } catch (\Exception $e) {
-                       $this->msg_plain  = '';
+                       $this->msg_plain = '';
                }
        }
 }
index 846aac4d0f1dacce165b48de65b61e877db15d5a..092f33b361d6ad370284f977e318fd837947fe1a 100644 (file)
@@ -25,7 +25,7 @@ class Field extends BaseDataTransferObject
 
        public function __construct(string $name, string $value)
        {
-               $this->name = $name;
+               $this->name  = $name;
                $this->value = $value;
                // Link verification unsupported
                $this->verified_at = null;
index 6d92b066f8b53aa59fb18d6f7298de43efeb28d8..5cf05b8aa0293bd4edeaf7cae005771a46057b7b 100644 (file)
@@ -245,8 +245,8 @@ class DiasporaContact extends BaseRepository
                        $uriId,
                        new DateTime($contact['created'] ?? 'now', new DateTimeZone('UTC')),
                        $interacting_count ?? 0,
-                       $interacted_count ?? 0,
-                       $post_count ?? 0
+                       $interacted_count  ?? 0,
+                       $post_count        ?? 0
                );
 
                $DiasporaContact = $this->save($DiasporaContact);
index c77baf0f2e17852dcd5dccaa16141841c0d6b352..42b6219e9c49031f54e1057a4741685a420a12f7 100644 (file)
@@ -119,8 +119,8 @@ class PermissionSet extends BaseRepository
 
                        $circle_ids = [];
                        if (!empty($user_contact_str) && $this->db->exists('contact', [
-                               'id' => $cid,
-                               'uid' => $uid,
+                               'id'      => $cid,
+                               'uid'     => $uid,
                                'blocked' => false
                        ])) {
                                $circle_ids = Circle::getIdsByContactId($cid);
index 9056596f271fd46f425e03cdc74a2a34c83a46b8..f04af4206119da9b06ecf288b5fcf699a84abb14 100644 (file)
@@ -79,33 +79,25 @@ class Security
         */
        public static function getPermissionsSQLByUserId(int $owner_id, bool $accessible = false)
        {
-               $local_user = DI::userSession()->getLocalUserId();
+               $local_user     = DI::userSession()->getLocalUserId();
                $remote_contact = DI::userSession()->getRemoteContactID($owner_id);
-               $acc_sql = '';
+               $acc_sql        = '';
 
                if ($accessible) {
                        $acc_sql = ' OR `accessible`';
                }
 
-               /*
-                * Construct permissions
-                *
-                * default permissions - anonymous user
-                */
+               // Construct permissions: default permissions - anonymous user
                $sql = " AND (allow_cid = ''
                         AND allow_gid = ''
                         AND deny_cid  = ''
                         AND deny_gid  = ''" . $acc_sql . ") ";
 
-               /*
-                * Profile owner - everything is visible
-                */
                if ($local_user && $local_user == $owner_id) {
+                       // Profile owner - everything is visible
                        $sql = '';
-               /*
-                * Authenticated visitor. Load the circles the visitor belongs to.
-                */
                } elseif ($remote_contact) {
+                       // Authenticated visitor. Load the circles the visitor belongs to.
                        $circleIds = '<<>>'; // should be impossible to match
 
                        foreach (Circle::getIdsByContactId($remote_contact) as $circleId) {