]> git.mxchange.org Git - friendica.git/commitdiff
Standards and unify variables
authorMichael <heluecht@pirati.ca>
Sat, 9 Sep 2023 13:02:20 +0000 (13:02 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 9 Sep 2023 13:02:20 +0000 (13:02 +0000)
src/Module/Conversation/Channel.php
src/Module/Conversation/Community.php
src/Module/Conversation/Network.php
src/Module/Conversation/Timeline.php

index ae570ba1deb42686f5fa3ae03cb445cf58fa517c..83ea662fd2eb219000406bc66b850163807ab40f 100644 (file)
@@ -159,6 +159,6 @@ class Channel extends Timeline
                        throw new HTTPException\BadRequestException($this->l10n->t('Channel not available.'));
                }
 
-               $this->max_id = $request['last_created'] ?? $this->max_id;
+               $this->maxId = $request['last_created'] ?? $this->maxId;
        }
 }
index adaf5bc111588f6fb91bb5c6e89318e7b113d798..8e0782cf5d56e78996224e64d015ebd1e5b0c605 100644 (file)
@@ -196,6 +196,6 @@ class Community extends Timeline
                        }
                }
 
-               $this->max_id = $request['last_commented'] ?? $this->max_id;
+               $this->maxId = $request['last_commented'] ?? $this->maxId;
        }
 }
index cbe15e3b5bd4ab0c7a84d741e7ad4e3e6798b80a..ce2283bdef4a2ca1bad1c129d270411a0f16cf7e 100644 (file)
@@ -369,17 +369,17 @@ class Network extends Timeline
 
                switch (self::$order) {
                        case 'received':
-                               $this->max_id = $request['last_received'] ?? $this->max_id;
+                               $this->maxId = $request['last_received'] ?? $this->maxId;
                                break;
                        case 'created':
-                               $this->max_id = $request['last_created'] ?? $this->max_id;
+                               $this->maxId = $request['last_created'] ?? $this->maxId;
                                break;
                        case 'uriid':
-                               $this->max_id = $request['last_uriid'] ?? $this->max_id;
+                               $this->maxId = $request['last_uriid'] ?? $this->maxId;
                                break;
                        default:
                                self::$order = 'commented';
-                               $this->max_id = $request['last_commented'] ?? $this->max_id;
+                               $this->maxId = $request['last_commented'] ?? $this->maxId;
                }
        }
 
@@ -421,42 +421,42 @@ class Network extends Timeline
                if (!empty($this->itemUriId)) {
                        $conditionStrings = DBA::mergeConditions($conditionStrings, ['uri-id' => $this->itemUriId]);
                } else {
-                       if (isset($this->max_id)) {
+                       if (isset($this->maxId)) {
                                switch (self::$order) {
                                        case 'received':
-                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` < ?", $this->max_id]);
+                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` < ?", $this->maxId]);
                                                break;
                                        case 'commented':
-                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` < ?", $this->max_id]);
+                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` < ?", $this->maxId]);
                                                break;
                                        case 'created':
-                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` < ?", $this->max_id]);
+                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` < ?", $this->maxId]);
                                                break;
                                        case 'uriid':
-                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` < ?", $this->max_id]);
+                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` < ?", $this->maxId]);
                                                break;
                                }
                        }
 
-                       if (isset($this->min_id)) {
+                       if (isset($this->minId)) {
                                switch (self::$order) {
                                        case 'received':
-                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` > ?", $this->min_id]);
+                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`received` > ?", $this->minId]);
                                                break;
                                        case 'commented':
-                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` > ?", $this->min_id]);
+                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`commented` > ?", $this->minId]);
                                                break;
                                        case 'created':
-                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` > ?", $this->min_id]);
+                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`created` > ?", $this->minId]);
                                                break;
                                        case 'uriid':
-                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` > ?", $this->min_id]);
+                                               $conditionStrings = DBA::mergeConditions($conditionStrings, ["`uri-id` > ?", $this->minId]);
                                                break;
                                }
                        }
                }
 
-               if (isset($this->min_id) && !isset($this->max_id)) {
+               if (isset($this->minId) && !isset($this->maxId)) {
                        // min_id quirk: querying in reverse order with min_id gets the most recent rows, regardless of how close
                        // they are to min_id. We change the query ordering to get the expected data, and we need to reverse the
                        // order of the results.
@@ -468,7 +468,7 @@ class Network extends Timeline
                $items = DBA::selectToArray($table, [], DBA::mergeConditions($conditionFields, $conditionStrings), $params);
 
                // min_id quirk, continued
-               if (isset($this->min_id) && !isset($this->max_id)) {
+               if (isset($this->minId) && !isset($this->maxId)) {
                        $items = array_reverse($items);
                }
 
index 8f97a38d8db5e5a9b291822da961a529d37e1e14..f692f97e7bfec3f1093c0aad2df33a8597fe9fa2 100644 (file)
@@ -49,9 +49,9 @@ class Timeline extends BaseModule
        /** @var string */
        protected $selectedTab;
        /** @var mixed */
-       protected $min_id;
+       protected $minId;
        /** @var mixed */
-       protected $max_id;
+       protected $maxId;
        /** @var string */
        protected $accountTypeString;
        /** @var int */
@@ -119,14 +119,14 @@ class Timeline extends BaseModule
                }
 
                if (!empty($request['item'])) {
-                       $item = Post::selectFirst(['parent', 'parent-uri-id'], ['id' => $request['item']]);
+                       $item            = Post::selectFirst(['parent', 'parent-uri-id'], ['id' => $request['item']]);
                        $this->itemUriId = $item['parent-uri-id'] ?? 0;
                } else {
                        $this->itemUriId = 0;
                }
 
-               $this->min_id = $request['min_id'] ?? null;
-               $this->max_id = $request['max_id'] ?? null;
+               $this->minId = $request['min_id'] ?? null;
+               $this->maxId = $request['max_id'] ?? null;
 
                $this->noSharer = !empty($request['no_sharer']);
        }
@@ -139,11 +139,11 @@ class Timeline extends BaseModule
                }
                $query_parameters = [];
 
-               if (!empty($this->min_id)) {
-                       $query_parameters['min_id'] = $this->min_id;
+               if (!empty($this->minId)) {
+                       $query_parameters['min_id'] = $this->minId;
                }
-               if (!empty($this->max_id)) {
-                       $query_parameters['max_id'] = $this->max_id;
+               if (!empty($this->maxId)) {
+                       $query_parameters['max_id'] = $this->maxId;
                }
 
                $path_all       = $path . (!empty($query_parameters) ? '?' . http_build_query($query_parameters) : '');
@@ -243,15 +243,15 @@ class Timeline extends BaseModule
                                $condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ? AND `post-user`.`uri-id` = `post-engagement`.`uri-id`)", $this->session->getLocalUserId()]);
                        }
 
-                       if (isset($this->max_id)) {
-                               $condition = DBA::mergeConditions($condition, ["`created` < ?", $this->max_id]);
+                       if (isset($this->maxId)) {
+                               $condition = DBA::mergeConditions($condition, ["`created` < ?", $this->maxId]);
                        }
 
-                       if (isset($this->min_id)) {
-                               $condition = DBA::mergeConditions($condition, ["`created` > ?", $this->min_id]);
+                       if (isset($this->minId)) {
+                               $condition = DBA::mergeConditions($condition, ["`created` > ?", $this->minId]);
 
                                // Previous page case: we want the items closest to min_id but for that we need to reverse the query order
-                               if (!isset($this->max_id)) {
+                               if (!isset($this->maxId)) {
                                        $params['order']['created'] = false;
                                }
                        }
@@ -263,7 +263,7 @@ class Timeline extends BaseModule
                }
 
                // Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order
-               if (empty($this->itemUriId) && isset($this->min_id) && !isset($this->max_id)) {
+               if (empty($this->itemUriId) && isset($this->minId) && !isset($this->maxId)) {
                        $items = array_reverse($items);
                }
 
@@ -393,11 +393,11 @@ class Timeline extends BaseModule
 
                                // If we're looking at a "previous page", the lookup continues forward in time because the list is
                                // sorted in chronologically decreasing order
-                               if (isset($this->min_id)) {
-                                       $this->min_id = $items[0]['commented'];
+                               if (isset($this->minId)) {
+                                       $this->minId = $items[0]['commented'];
                                } else {
                                        // In any other case, the lookup continues backwards in time
-                                       $this->max_id = $items[count($items) - 1]['commented'];
+                                       $this->maxId = $items[count($items) - 1]['commented'];
                                }
 
                                $items = $this->selectItems();
@@ -443,15 +443,15 @@ class Timeline extends BaseModule
                                $condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ? AND `post-user`.`uri-id` = `post-thread-user-view`.`uri-id`)", $this->session->getLocalUserId()]);
                        }
 
-                       if (isset($this->max_id)) {
-                               $condition = DBA::mergeConditions($condition, ["`commented` < ?", $this->max_id]);
+                       if (isset($this->maxId)) {
+                               $condition = DBA::mergeConditions($condition, ["`commented` < ?", $this->maxId]);
                        }
 
-                       if (isset($this->min_id)) {
-                               $condition = DBA::mergeConditions($condition, ["`commented` > ?", $this->min_id]);
+                       if (isset($this->minId)) {
+                               $condition = DBA::mergeConditions($condition, ["`commented` > ?", $this->minId]);
 
                                // Previous page case: we want the items closest to min_id but for that we need to reverse the query order
-                               if (!isset($this->max_id)) {
+                               if (!isset($this->maxId)) {
                                        $params['order']['commented'] = false;
                                }
                        }
@@ -465,7 +465,7 @@ class Timeline extends BaseModule
                }
 
                // Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order
-               if (empty($this->itemUriId) && isset($this->min_id) && !isset($this->max_id)) {
+               if (empty($this->itemUriId) && isset($this->minId) && !isset($this->maxId)) {
                        $items = array_reverse($items);
                }