]> git.mxchange.org Git - friendica.git/commitdiff
Change static methods to dynamic in Mastodon Search class
authorArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 12:07:05 +0000 (12:07 +0000)
committerArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 12:07:05 +0000 (12:07 +0000)
src/Module/Api/Mastodon/Search.php

index 831ac010f8aa00ba96b33ef465268fd0756b13ae..532b45dd99a82e7ae0825f59e9126f162d53f69f 100644 (file)
@@ -53,7 +53,7 @@ class Search extends BaseApi
                $result = ['accounts' => [], 'statuses' => [], 'hashtags' => []];
 
                if (empty($request['type']) || ($request['type'] == 'accounts')) {
-                       $result['accounts'] = self::searchAccounts($uid, $request['q'], $request['resolve'], $limit, $request['offset'], $request['following']);
+                       $result['accounts'] = $this->searchAccounts($uid, $request['q'], $request['resolve'], $limit, $request['offset'], $request['following']);
 
                        if (!is_array($result['accounts'])) {
                                // Curbing the search if we got an exact result
@@ -63,7 +63,7 @@ class Search extends BaseApi
                }
 
                if (empty($request['type']) || ($request['type'] == 'statuses')) {
-                       $result['statuses'] = self::searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']);
+                       $result['statuses'] = $this->searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']);
 
                        if (!is_array($result['statuses'])) {
                                // Curbing the search if we got an exact result
@@ -73,7 +73,7 @@ class Search extends BaseApi
                }
 
                if ((empty($request['type']) || ($request['type'] == 'hashtags')) && (strpos($request['q'], '@') == false)) {
-                       $result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], $this->parameters['version']);
+                       $result['hashtags'] = $this->searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], $this->parameters['version']);
                }
 
                $this->jsonExit($result);
@@ -91,7 +91,7 @@ class Search extends BaseApi
         * @throws \Friendica\Network\HTTPException\NotFoundException
         * @throws \ImagickException
         */
-       private static function searchAccounts(int $uid, string $q, bool $resolve, int $limit, int $offset, bool $following)
+       private function searchAccounts(int $uid, string $q, bool $resolve, int $limit, int $offset, bool $following)
        {
                if (($offset == 0) && (strrpos($q, '@') > 0 || Network::isValidHttpUrl($q))
                        && $id = Contact::getIdForURL($q, 0, $resolve ? null : false)
@@ -120,7 +120,7 @@ class Search extends BaseApi
         * @throws \Friendica\Network\HTTPException\NotFoundException
         * @throws \ImagickException
         */
-       private static function searchStatuses(int $uid, string $q, string $account_id, int $max_id, int $min_id, int $limit, int $offset)
+       private function searchStatuses(int $uid, string $q, string $account_id, int $max_id, int $min_id, int $limit, int $offset)
        {
                if (Network::isValidHttpUrl($q)) {
                        // Unique post search, any offset greater than 0 should return empty result
@@ -185,7 +185,7 @@ class Search extends BaseApi
                return $statuses;
        }
 
-       private static function searchHashtags(string $q, bool $exclude_unreviewed, int $limit, int $offset, int $version): array
+       private function searchHashtags(string $q, bool $exclude_unreviewed, int $limit, int $offset, int $version): array
        {
                $q = ltrim($q, '#');