1 | <?php |
||
27 | class ElasticSearchCursor implements FinderCursorInterface |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * Whether query was sent to search server |
||
32 | * @var bool |
||
33 | */ |
||
34 | private $isExecuted = false; |
||
35 | |||
36 | /** |
||
37 | * |
||
38 | * @var QueryBuilder |
||
39 | */ |
||
40 | private $qb = null; |
||
41 | |||
42 | /** |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | private $data = []; |
||
47 | |||
48 | 60 | public function __construct(QueryBuilder $qb) |
|
57 | |||
58 | 47 | public function limit($num) |
|
63 | |||
64 | 42 | public function skip($num) |
|
69 | |||
70 | 48 | public function sort(array $fields) |
|
75 | |||
76 | 1 | public function fields(array $fields) |
|
81 | |||
82 | // <editor-fold defaultstate="collapsed" desc="Countable impl"> |
||
83 | |||
84 | /** |
||
85 | * |
||
86 | * @return int |
||
87 | */ |
||
88 | 6 | public function count() |
|
93 | |||
94 | // </editor-fold> |
||
95 | // <editor-fold defaultstate="collapsed" desc="Iterator impl"> |
||
96 | 51 | public function current() |
|
101 | |||
102 | public function key() |
||
107 | |||
108 | 44 | public function next() |
|
109 | { |
||
110 | 44 | $this->execute(); |
|
111 | 44 | next($this->data); |
|
112 | 44 | } |
|
113 | |||
114 | 48 | public function rewind() |
|
119 | |||
120 | 48 | public function valid() |
|
126 | |||
127 | 60 | private function execute() |
|
159 | |||
160 | // </editor-fold> |
||
161 | } |
||
162 |