From 419cc81ef145015d087ffb4f54eb985bc49d2e05 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sun, 19 May 2019 05:13:06 +0200 Subject: [PATCH] renaming --- src/Database/DBA.php | 2 +- src/Model/Search.php | 22 +++++++++---------- src/Module/BaseSearchModule.php | 14 ++++++------ .../Search/{Result.php => ContactResult.php} | 14 ++++++------ .../{ResultList.php => ContactResultList.php} | 21 +++++++++--------- 5 files changed, 37 insertions(+), 36 deletions(-) rename src/Object/Search/{Result.php => ContactResult.php} (90%) rename src/Object/Search/{ResultList.php => ContactResultList.php} (73%) diff --git a/src/Database/DBA.php b/src/Database/DBA.php index 9367e2681f..2327e4a7f6 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -1540,7 +1540,7 @@ class DBA $limit_string = " LIMIT " . intval($params['limit'][0]) . ", " . intval($params['limit'][1]); } - return $groupby_string.$order_string.$limit_string; + return $groupby_string . $order_string . $limit_string; } /** diff --git a/src/Model/Search.php b/src/Model/Search.php index 815f2dc633..80d5e6698d 100644 --- a/src/Model/Search.php +++ b/src/Model/Search.php @@ -7,8 +7,8 @@ use Friendica\Core\Protocol; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Network\Probe; -use Friendica\Object\Search\Result; -use Friendica\Object\Search\ResultList; +use Friendica\Object\Search\ContactResult; +use Friendica\Object\Search\ContactResultList; use Friendica\Protocol\PortableContact; use Friendica\Util\Network; use Friendica\Util\Strings; @@ -46,7 +46,7 @@ class Search extends BaseObject * * @param string $user The user to search for * - * @return ResultList|null + * @return ContactResultList|null * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ @@ -67,7 +67,7 @@ class Search extends BaseObject $contactDetails = Contact::getDetailsByURL(defaults($user_data, 'url', ''), local_user()); $itemurl = (($contactDetails["addr"] != "") ? $contactDetails["addr"] : defaults($user_data, 'url', '')); - $result = new Result( + $result = new ContactResult( defaults($user_data, 'name', ''), defaults($user_data, 'addr', ''), $itemurl, @@ -79,7 +79,7 @@ class Search extends BaseObject defaults($user_data, 'tags', '') ); - return new ResultList(1, 1, 1, [$result]); + return new ContactResultList(1, 1, 1, [$result]); } else { return null; @@ -93,7 +93,7 @@ class Search extends BaseObject * @param string $search * @param int $page * - * @return ResultList|null + * @return ContactResultList|null * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function searchDirectory($search, $page = 1) @@ -112,7 +112,7 @@ class Search extends BaseObject $results = json_decode($resultJson, true); - $resultList = new ResultList( + $resultList = new ContactResultList( defaults($results, 'page', 1), defaults($results, 'count', 1), defaults($results, 'itemsperpage', 1) @@ -124,7 +124,7 @@ class Search extends BaseObject $contactDetails = Contact::getDetailsByURL(defaults($profile, 'profile_url', ''), local_user()); $itemurl = (!empty($contactDetails['addr']) ? $contactDetails['addr'] : defaults($profile, 'profile_url', '')); - $result = new Result( + $result = new ContactResult( defaults($profile, 'name', ''), defaults($profile, 'addr', ''), $itemurl, @@ -149,7 +149,7 @@ class Search extends BaseObject * @param int $itemPage * @param bool $community * - * @return ResultList|null + * @return ContactResultList|null * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function searchLocal($search, $start = 0, $itemPage = 80, $community = false) @@ -199,7 +199,7 @@ class Search extends BaseObject return null; } - $resultList = new ResultList($start, $itemPage, $count); + $resultList = new ContactResultList($start, $itemPage, $count); while ($row = DBA::fetch($data)) { if (PortableContact::alternateOStatusUrl($row["nurl"])) { @@ -220,7 +220,7 @@ class Search extends BaseObject $contact["name"] = end(explode("/", $urlparts["path"])); } - $result = new Result( + $result = new ContactResult( $contact["name"], $contact["addr"], $contact["addr"], diff --git a/src/Module/BaseSearchModule.php b/src/Module/BaseSearchModule.php index 7028208286..9430ec1b91 100644 --- a/src/Module/BaseSearchModule.php +++ b/src/Module/BaseSearchModule.php @@ -7,7 +7,7 @@ use Friendica\Content\ContactSelector; use Friendica\Content\Pager; use Friendica\Core\L10n; use Friendica\Core\Renderer; -use Friendica\Object\Search\ResultList; +use Friendica\Object\Search\ContactResultList; use Friendica\Util\Proxy as ProxyUtils; use Friendica\Model; use Friendica\Util\Strings; @@ -72,15 +72,15 @@ class BaseSearchModule extends BaseModule /** * Prints a human readable search result * - * @param ResultList $results - * @param Pager $pager - * @param string $header + * @param ContactResultList $results + * @param Pager $pager + * @param string $header * * @return string The result * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ - protected static function printResult(ResultList $results, Pager $pager, $header = '') + protected static function printResult(ContactResultList $results, Pager $pager, $header = '') { if (empty($results) || empty($results->getResults())) { info(L10n::t('No matches') . EOL); @@ -100,11 +100,11 @@ class BaseSearchModule extends BaseModule $photo_menu = []; // If We already know this contact then don't show the "connect" button - if ($result->getCid() > 0 || $result->getPcid() > 0) { + if ($result->getCid() > 0 || $result->getPCid() > 0) { $connLink = ""; $connTxt = ""; $contact = Model\Contact::getById( - ($result->getCid() > 0) ? $result->getCid() : $result->getPcid() + ($result->getCid() > 0) ? $result->getCid() : $result->getPCid() ); if (!empty($contact)) { diff --git a/src/Object/Search/Result.php b/src/Object/Search/ContactResult.php similarity index 90% rename from src/Object/Search/Result.php rename to src/Object/Search/ContactResult.php index 10d6b0aa03..699afa862d 100644 --- a/src/Object/Search/Result.php +++ b/src/Object/Search/ContactResult.php @@ -5,11 +5,11 @@ namespace Friendica\Object\Search; use Friendica\Model\Search; /** - * A search result + * A search result for contact searching * - * @see Search for defails + * @see Search for details */ -class Result +class ContactResult { /** * @var int @@ -18,7 +18,7 @@ class Result /** * @var int */ - private $pcid; + private $pCid; /** * @var string */ @@ -59,9 +59,9 @@ class Result /** * @return int */ - public function getPcid() + public function getPCid() { - return $this->pcid; + return $this->pCid; } /** @@ -140,7 +140,7 @@ class Result $this->network = $network; $this->cid = $cid; - $this->pcid = $pcid; + $this->pCid = $pcid; $this->tags = $tags; } } diff --git a/src/Object/Search/ResultList.php b/src/Object/Search/ContactResultList.php similarity index 73% rename from src/Object/Search/ResultList.php rename to src/Object/Search/ContactResultList.php index 88caaa7e56..f3014d3841 100644 --- a/src/Object/Search/ResultList.php +++ b/src/Object/Search/ContactResultList.php @@ -5,11 +5,11 @@ namespace Friendica\Object\Search; use Friendica\Model\Search; /** - * A list of search results with details + * A list of search results for contacts with metadata * * @see Search for details */ -class ResultList +class ContactResultList { /** * Page of the result list @@ -28,7 +28,8 @@ class ResultList private $itemsPage; /** * Array of results - * @var Result[] + * + * @var ContactResult[] */ private $results; @@ -57,7 +58,7 @@ class ResultList } /** - * @return Result[] + * @return ContactResult[] */ public function getResults() { @@ -65,10 +66,10 @@ class ResultList } /** - * @param int $page - * @param int $total - * @param int $itemsPage - * @param Result[] $results + * @param int $page + * @param int $total + * @param int $itemsPage + * @param ContactResult[] $results */ public function __construct($page = 0, $total = 0, $itemsPage = 0, array $results = []) { @@ -82,9 +83,9 @@ class ResultList /** * Adds a result to the result list * - * @param Result $result + * @param ContactResult $result */ - public function addResult(Result $result) + public function addResult(ContactResult $result) { $this->results[] = $result; } -- 2.39.5