Moving Search to Core, Refactor Objects
[friendica.git/.git] / src / Object / Search / ResultList.php
1 <?php
2
3 namespace Friendica\Object\Search;
4
5 use Friendica\Model\Search;
6
7 /**
8  * A list of search results with metadata
9  *
10  * @see Search for details
11  */
12 class ResultList
13 {
14         /**
15          * Page of the result list
16          * @var int
17          */
18         private $page;
19         /**
20          * Total count of results
21          * @var int
22          */
23         private $total;
24         /**
25          * items per page
26          * @var int
27          */
28         private $itemsPage;
29         /**
30          * Array of results
31          *
32          * @var IResult[]
33          */
34         private $results;
35
36         /**
37          * @return int
38          */
39         public function getPage()
40         {
41                 return $this->page;
42         }
43
44         /**
45          * @return int
46          */
47         public function getTotal()
48         {
49                 return $this->total;
50         }
51
52         /**
53          * @return int
54          */
55         public function getItemsPage()
56         {
57                 return $this->itemsPage;
58         }
59
60         /**
61          * @return IResult[]
62          */
63         public function getResults()
64         {
65                 return $this->results;
66         }
67
68         /**
69          * @param int             $page
70          * @param int             $total
71          * @param int             $itemsPage
72          * @param IResult[] $results
73          */
74         public function __construct($page = 0, $total = 0, $itemsPage = 0, array $results = [])
75         {
76                 $this->page      = $page;
77                 $this->total     = $total;
78                 $this->itemsPage = $itemsPage;
79
80                 $this->results = $results;
81         }
82
83         /**
84          * Adds a result to the result list
85          *
86          * @param IResult $result
87          */
88         public function addResult(IResult $result)
89         {
90                 $this->results[] = $result;
91         }
92 }