Moving Search to Core, Refactor Objects

This commit is contained in:
Philipp Holzer 2019-05-20 18:42:27 +02:00
parent 419cc81ef1
commit 1e36c68e48
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
6 changed files with 306 additions and 279 deletions

View file

@ -9,7 +9,7 @@ use Friendica\Model\Search;
*
* @see Search for details
*/
class ContactResult
class ContactResult implements IResult
{
/**
* @var int
@ -123,14 +123,15 @@ class ContactResult
/**
* @param string $name
* @param string $addr
* @param string $item
* @param string $url
* @param string $photo
* @param string $network
* @param int $cid
* @param int $pcid
* @param int $pCid
* @param string $tags
*/
public function __construct($name, $addr, $item, $url, $photo, $network, $cid = 0, $pcid = 0, $tags = '')
public function __construct($name, $addr, $item, $url, $photo, $network, $cid = 0, $pCid = 0, $tags = '')
{
$this->name = $name;
$this->addr = $addr;
@ -140,7 +141,7 @@ class ContactResult
$this->network = $network;
$this->cid = $cid;
$this->pCid = $pcid;
$this->pCid = $pCid;
$this->tags = $tags;
}
}

View file

@ -0,0 +1,10 @@
<?php
namespace Friendica\Object\Search;
interface IResult
{
}

View file

@ -5,11 +5,11 @@ namespace Friendica\Object\Search;
use Friendica\Model\Search;
/**
* A list of search results for contacts with metadata
* A list of search results with metadata
*
* @see Search for details
*/
class ContactResultList
class ResultList
{
/**
* Page of the result list
@ -29,7 +29,7 @@ class ContactResultList
/**
* Array of results
*
* @var ContactResult[]
* @var IResult[]
*/
private $results;
@ -58,7 +58,7 @@ class ContactResultList
}
/**
* @return ContactResult[]
* @return IResult[]
*/
public function getResults()
{
@ -69,7 +69,7 @@ class ContactResultList
* @param int $page
* @param int $total
* @param int $itemsPage
* @param ContactResult[] $results
* @param IResult[] $results
*/
public function __construct($page = 0, $total = 0, $itemsPage = 0, array $results = [])
{
@ -83,9 +83,9 @@ class ContactResultList
/**
* Adds a result to the result list
*
* @param ContactResult $result
* @param IResult $result
*/
public function addResult(ContactResult $result)
public function addResult(IResult $result)
{
$this->results[] = $result;
}