From: Philipp Holzer Date: Sun, 19 May 2019 03:13:06 +0000 (+0200) Subject: renaming X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=419cc81ef145015d087ffb4f54eb985bc49d2e05;p=friendica.git renaming --- 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/ContactResult.php b/src/Object/Search/ContactResult.php new file mode 100644 index 0000000000..699afa862d --- /dev/null +++ b/src/Object/Search/ContactResult.php @@ -0,0 +1,146 @@ +cid; + } + + /** + * @return int + */ + public function getPCid() + { + return $this->pCid; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @return string + */ + public function getAddr() + { + return $this->addr; + } + + /** + * @return string + */ + public function getItem() + { + return $this->item; + } + + /** + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * @return string + */ + public function getPhoto() + { + return $this->photo; + } + + /** + * @return string + */ + public function getTags() + { + return $this->tags; + } + + /** + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * @param string $name + * @param string $addr + * @param string $url + * @param string $photo + * @param string $network + * @param int $cid + * @param int $pcid + * @param string $tags + */ + public function __construct($name, $addr, $item, $url, $photo, $network, $cid = 0, $pcid = 0, $tags = '') + { + $this->name = $name; + $this->addr = $addr; + $this->item = $item; + $this->url = $url; + $this->photo = $photo; + $this->network = $network; + + $this->cid = $cid; + $this->pCid = $pcid; + $this->tags = $tags; + } +} diff --git a/src/Object/Search/ContactResultList.php b/src/Object/Search/ContactResultList.php new file mode 100644 index 0000000000..f3014d3841 --- /dev/null +++ b/src/Object/Search/ContactResultList.php @@ -0,0 +1,92 @@ +page; + } + + /** + * @return int + */ + public function getTotal() + { + return $this->total; + } + + /** + * @return int + */ + public function getItemsPage() + { + return $this->itemsPage; + } + + /** + * @return ContactResult[] + */ + public function getResults() + { + return $this->results; + } + + /** + * @param int $page + * @param int $total + * @param int $itemsPage + * @param ContactResult[] $results + */ + public function __construct($page = 0, $total = 0, $itemsPage = 0, array $results = []) + { + $this->page = $page; + $this->total = $total; + $this->itemsPage = $itemsPage; + + $this->results = $results; + } + + /** + * Adds a result to the result list + * + * @param ContactResult $result + */ + public function addResult(ContactResult $result) + { + $this->results[] = $result; + } +} diff --git a/src/Object/Search/Result.php b/src/Object/Search/Result.php deleted file mode 100644 index 10d6b0aa03..0000000000 --- a/src/Object/Search/Result.php +++ /dev/null @@ -1,146 +0,0 @@ -cid; - } - - /** - * @return int - */ - public function getPcid() - { - return $this->pcid; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @return string - */ - public function getAddr() - { - return $this->addr; - } - - /** - * @return string - */ - public function getItem() - { - return $this->item; - } - - /** - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * @return string - */ - public function getPhoto() - { - return $this->photo; - } - - /** - * @return string - */ - public function getTags() - { - return $this->tags; - } - - /** - * @return string - */ - public function getNetwork() - { - return $this->network; - } - - /** - * @param string $name - * @param string $addr - * @param string $url - * @param string $photo - * @param string $network - * @param int $cid - * @param int $pcid - * @param string $tags - */ - public function __construct($name, $addr, $item, $url, $photo, $network, $cid = 0, $pcid = 0, $tags = '') - { - $this->name = $name; - $this->addr = $addr; - $this->item = $item; - $this->url = $url; - $this->photo = $photo; - $this->network = $network; - - $this->cid = $cid; - $this->pcid = $pcid; - $this->tags = $tags; - } -} diff --git a/src/Object/Search/ResultList.php b/src/Object/Search/ResultList.php deleted file mode 100644 index 88caaa7e56..0000000000 --- a/src/Object/Search/ResultList.php +++ /dev/null @@ -1,91 +0,0 @@ -page; - } - - /** - * @return int - */ - public function getTotal() - { - return $this->total; - } - - /** - * @return int - */ - public function getItemsPage() - { - return $this->itemsPage; - } - - /** - * @return Result[] - */ - public function getResults() - { - return $this->results; - } - - /** - * @param int $page - * @param int $total - * @param int $itemsPage - * @param Result[] $results - */ - public function __construct($page = 0, $total = 0, $itemsPage = 0, array $results = []) - { - $this->page = $page; - $this->total = $total; - $this->itemsPage = $itemsPage; - - $this->results = $results; - } - - /** - * Adds a result to the result list - * - * @param Result $result - */ - public function addResult(Result $result) - { - $this->results[] = $result; - } -}