1 | <?php |
||
12 | class SearchResult implements \ArrayAccess, \Countable, \IteratorAggregate |
||
13 | { |
||
14 | /** |
||
15 | * @var int $totalCount |
||
16 | */ |
||
17 | protected $totalCount; |
||
18 | |||
19 | /** |
||
20 | * @var array|array[]|object[] $results |
||
21 | */ |
||
22 | protected $results = []; |
||
23 | |||
24 | |||
25 | public function __construct($results, $totalCount) |
||
31 | |||
32 | /** |
||
33 | * Returns first entry from result set, or null, |
||
34 | * if result set is empty. |
||
35 | * |
||
36 | * @return null|array|object|array[]|object[] |
||
37 | */ |
||
38 | public function getFirst() |
||
46 | |||
47 | /** |
||
48 | * Returns the complete result set. |
||
49 | * |
||
50 | * @return array |
||
51 | */ |
||
52 | public function getResults() |
||
56 | |||
57 | /** |
||
58 | * Method returns count of returned query results. |
||
59 | * |
||
60 | * @return int |
||
61 | */ |
||
62 | public function count() |
||
66 | |||
67 | /** |
||
68 | * Method returns count of total query results in index. |
||
69 | * |
||
70 | * @return int |
||
71 | */ |
||
72 | public function getTotalCount() |
||
76 | |||
77 | /** |
||
78 | * Method determines, if result data set is empty. |
||
79 | * |
||
80 | * @return bool |
||
81 | */ |
||
82 | public function isEmpty() |
||
86 | |||
87 | public function offsetExists($offset) |
||
91 | |||
92 | public function offsetGet($offset) |
||
96 | |||
97 | public function offsetSet($offset, $value) |
||
103 | |||
104 | public function offsetUnset($offset) |
||
110 | |||
111 | public function getIterator() |
||
115 | } |
||
116 |