1 | <?php namespace Bardex\Elastic; |
||
9 | class SearchResult implements \ArrayAccess, \Countable, \IteratorAggregate |
||
10 | { |
||
11 | /** |
||
12 | * @var int |
||
13 | */ |
||
14 | protected $totalFound; |
||
15 | |||
16 | /** |
||
17 | * @var array|array[]|object[] $results |
||
18 | */ |
||
19 | protected $results = []; |
||
20 | |||
21 | |||
22 | public function __construct($results, $totalFound) |
||
28 | |||
29 | /** |
||
30 | * Returns first entry from result set, or null, |
||
31 | * if result set is empty. |
||
32 | * |
||
33 | * @return null|array|object|array[]|object[] |
||
34 | */ |
||
35 | public function getFirst() |
||
43 | |||
44 | /** |
||
45 | * Returns the complete result set. |
||
46 | * |
||
47 | * @return array |
||
48 | */ |
||
49 | public function getResults() |
||
53 | |||
54 | /** |
||
55 | * Method returns count of returned query results. |
||
56 | * |
||
57 | * @return int |
||
58 | */ |
||
59 | public function count() |
||
63 | |||
64 | /** |
||
65 | * Method returns count of total query results in index. |
||
66 | * |
||
67 | * @return int |
||
68 | */ |
||
69 | public function getTotalFound() |
||
73 | |||
74 | /** |
||
75 | * @deprecated |
||
76 | * @return int |
||
77 | */ |
||
78 | public function getTotalCount() |
||
82 | |||
83 | |||
84 | /** |
||
85 | * Method determines, if result data set is empty. |
||
86 | * |
||
87 | * @return bool |
||
88 | */ |
||
89 | public function isEmpty() |
||
93 | |||
94 | public function offsetExists($offset) |
||
98 | |||
99 | public function offsetGet($offset) |
||
103 | |||
104 | public function offsetSet($offset, $value) |
||
110 | |||
111 | public function offsetUnset($offset) |
||
117 | |||
118 | public function getIterator() |
||
122 | } |
||
123 |