| 1 | <?php |
||
| 6 | class Xhgui_Storage_ResultSet implements \Iterator, \Countable |
||
| 7 | { |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @var array|null |
||
| 11 | */ |
||
| 12 | protected $data = []; |
||
| 13 | /** |
||
| 14 | * @var array |
||
| 15 | */ |
||
| 16 | protected $keys = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var int |
||
| 20 | */ |
||
| 21 | protected $i = 0; |
||
| 22 | /** |
||
| 23 | * @var int |
||
| 24 | */ |
||
| 25 | protected $limit = 25; |
||
| 26 | /** |
||
| 27 | * @var int |
||
| 28 | */ |
||
| 29 | protected $totalRows = 0; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Xhgui_Storage_ResultSet constructor. |
||
| 33 | * @param null $data |
||
| 34 | * @param int $totalRows |
||
| 35 | */ |
||
| 36 | public function __construct($data = null, $totalRows = 0) |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return array|null |
||
| 45 | */ |
||
| 46 | public function toArray() |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return int |
||
| 53 | */ |
||
| 54 | public function count() |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return $this |
||
| 61 | */ |
||
| 62 | public function sort() |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param $count |
||
| 69 | * @return $this |
||
| 70 | */ |
||
| 71 | public function skip($count) |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @param $limit |
||
| 79 | * @return $this |
||
| 80 | */ |
||
| 81 | public function limit($limit) |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @param $i |
||
| 89 | * @return mixed |
||
| 90 | */ |
||
| 91 | public function get($i) |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Return the current element |
||
| 98 | */ |
||
| 99 | public function current() |
||
| 103 | |||
| 104 | /** |
||
| 105 | * Move forward to next element |
||
| 106 | */ |
||
| 107 | public function next() |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Return the key of the current element |
||
| 114 | */ |
||
| 115 | public function key() |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Checks if current position is valid |
||
| 122 | * |
||
| 123 | * Returns true on success or false on failure. |
||
| 124 | */ |
||
| 125 | public function valid() |
||
| 129 | |||
| 130 | /** |
||
| 131 | * Rewind the Iterator to the first element |
||
| 132 | */ |
||
| 133 | public function rewind() |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @return int |
||
| 140 | */ |
||
| 141 | public function getTotalRows() |
||
| 145 | |||
| 146 | /** |
||
| 147 | * @param int $totalRows |
||
| 148 | */ |
||
| 149 | public function setTotalRows($totalRows) |
||
| 153 | } |
||
| 154 |