From 5e79d3fc8279316ebccdc06b791e2d30079e386e Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Mon, 20 May 2019 19:19:57 +0200 Subject: [PATCH] Fixing method signature --- src/Core/Search.php | 17 ++++++++++------- src/Module/BaseSearchModule.php | 16 ++++++++-------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/Core/Search.php b/src/Core/Search.php index 3a97a700d..0a234d748 100644 --- a/src/Core/Search.php +++ b/src/Core/Search.php @@ -52,7 +52,7 @@ class Search extends BaseObject } $contactDetails = Contact::getDetailsByURL(defaults($user_data, 'url', ''), local_user()); - $itemUrl = (($contactDetails["addr"] != "") ? $contactDetails["addr"] : defaults($user_data, 'url', '')); + $itemUrl = (($contactDetails["addr"] != "") ? $contactDetails["addr"] : defaults($user_data, 'url', '')); $result = new ContactResult( defaults($user_data, 'name', ''), @@ -75,6 +75,7 @@ class Search extends BaseObject /** * Search in the global directory for occurrences of the search string + * * @see https://github.com/friendica/friendica-directory/blob/master/docs/Protocol.md#search * * @param string $search @@ -105,10 +106,10 @@ class Search extends BaseObject $searchUrl .= '&page=' . $page; } - $red = 0; - $resultJson = Network::fetchUrl($searchUrl, false,$red, 0, 'application/json'); + $red = 0; + $resultJson = Network::fetchUrl($searchUrl, false, $red, 0, 'application/json'); - $results = json_decode($resultJson, true); + $results = json_decode($resultJson, true); $resultList = new ResultList( defaults($results, 'page', 1), @@ -120,7 +121,9 @@ class Search extends BaseObject foreach ($profiles as $profile) { $contactDetails = Contact::getDetailsByURL(defaults($profile, 'profile_url', ''), local_user()); - $itemUrl = (!empty($contactDetails['addr']) ? $contactDetails['addr'] : defaults($profile, 'profile_url', '')); + $itemUrl = (!empty($contactDetails['addr']) ? + $contactDetails['addr'] : + defaults($profile, 'profile_url', '')); $result = new ContactResult( defaults($profile, 'name', ''), @@ -189,8 +192,8 @@ class Search extends BaseObject ($type === self::TYPE_FORUM), ], [ 'group_by' => ['nurl', 'updated'], - 'limit' => [$start, $itemPage], - 'order' => ['updated' => 'DESC'] + 'limit' => [$start, $itemPage], + 'order' => ['updated' => 'DESC'] ]); if (!DBA::isResult($data)) { diff --git a/src/Module/BaseSearchModule.php b/src/Module/BaseSearchModule.php index bba029db5..226a4da4d 100644 --- a/src/Module/BaseSearchModule.php +++ b/src/Module/BaseSearchModule.php @@ -48,15 +48,15 @@ class BaseSearchModule extends BaseModule if (strpos($search, '@') === 0) { $search = substr($search, 1); - $type = Search::TYPE_PEOPLE; + $type = Search::TYPE_PEOPLE; $header = L10n::t('People Search - %s', $search); $results = Search::getContactsFromProbe($search); } if (strpos($search, '!') === 0) { - $search = substr($search, 1); - $type = Search::TYPE_FORUM; - $header = L10n::t('Forum Search - %s', $search); + $search = substr($search, 1); + $type = Search::TYPE_FORUM; + $header = L10n::t('Forum Search - %s', $search); } $pager = new Pager($a->query_string); @@ -66,7 +66,7 @@ class BaseSearchModule extends BaseModule $results = Search::getContactsFromLocalDirectory($search, $type, $pager->getStart(), $pager->getItemsPerPage()); } elseif (strlen($config->get('system', 'directory')) && empty($results)) { - $results = Search::getContactsFromGlobalDirectory($search, $pager->getPage(), $type); + $results = Search::getContactsFromGlobalDirectory($search, $type, $pager->getPage()); $pager->setItemsPerPage($results->getItemsPage()); } @@ -77,8 +77,8 @@ class BaseSearchModule extends BaseModule * Prints a human readable search result * * @param ResultList $results - * @param Pager $pager - * @param string $header + * @param Pager $pager + * @param string $header * * @return string The result * @throws HTTPException\InternalServerErrorException @@ -93,7 +93,7 @@ class BaseSearchModule extends BaseModule $a = self::getApp(); - $id = 0; + $id = 0; $entries = []; foreach ($results->getResults() as $result) {