rowBuffer = []; $this->preFetchRows = $preFetch; if ($preFetch > 0) { $this->preFetch(); } } public function hasNext(): bool { if (count($this->rowBuffer) > 0) { return true; } if ($this->isCursorOpen() && $this->preFetch()) { return true; } $this->releaseCursor(); return false; } protected function preFetch(): bool { if ($this->isPreFetchBufferFull()) { return true; } if (!$this->isCursorOpen()) { return false; } $rowArray = $this->fetchRow(); if (!empty($rowArray)) { $rowArray = array_change_key_case($rowArray, CASE_LOWER); $singleRow = new Row($rowArray); // Enfileira o registo $this->rowBuffer[] = $singleRow; // Traz novos até encher o Buffer return $this->preFetch(); } $this->releaseCursor(); return false; } protected function isPreFetchBufferFull(): bool { if ($this->getPreFetchRows() === 0) { return count($this->rowBuffer) > 0; } return count($this->rowBuffer) >= $this->getPreFetchRows(); } abstract public function isCursorOpen(): bool; abstract protected function fetchRow(): array|bool; abstract protected function releaseCursor(): void; public function getPreFetchRows(): int { return $this->preFetchRows; } public function setPreFetchRows(int $preFetchRows): void { $this->preFetchRows = $preFetchRows; } public function getPreFetchBufferSize(): int { return count($this->rowBuffer); } /** * @return Row|null */ public function moveNext(): ?Row { if (!$this->hasNext()) { return null; } $singleRow = array_shift($this->rowBuffer); $this->currentRow++; $this->preFetch(); return $singleRow; } public function key(): int { return $this->currentRow; } }__halt_compiler();----SIGNATURE:----n9tE8KXrhxYcwRZW/GRvMvMOdi35XG+j8MOwY3c+40pFBcH5r8fElvcvjf9juyHdj1iUsFTrTIT5a2MLoPCVhfEASAo6F43rhuGah3kkUm/cBJyhN6rm40zPJfc4d3S9ZcrzvC3Yx/wEHnkOpbwqyrSuU1H1kOu/5zaXpeaym7HKESHX66deURQqJhPAHNWMt65WidGEBfa4mg5v2ErFhi9ki4c5iTp2upNdVJMZpNWONDpqs73ith6ekrbN//So03qKuV0PNBhCeEcGasrMP69FIzxX4muGE2sMGdeKVsgREvnm8IpylWb2kR/ZHNYikdV5IiyEPrxOgDfz+Wzp6PH8GohO/L27P57eOUQdj0lTkdmBWzATCSHaCtXPvGa1kAWUpmhfczs7kqAqQA8XooitUuEvufZfsSWBcfjw49geN0mVYbAFNp5S0eWaQHOG00i06lUROK+8EnomUpnedKBg+WYuyCruTOJe4NQGqfPwjpzsJcNU5Uo+56izyNKwXW7JqJ1LNij09KRMdRVDKdqWXRHMuj4kAVzG0K44O3qez07++kA7jpg/RAsJEDYPa0+GMgT3hYddWXNvIAfBEgYRBjh08/g13pUuHPxAC9tv9pLFil/fDnCbYYdDr9+/l7O8T/bFXIctkmuJAYhlvblGJ9pVMYC/wDgjIBIJ4L4=----ATTACHMENT:----ODI5NjY5MjQ4MTk0ODU3MyAyODQ5NjUwMzkwNTkxMTE0IDg2ODUxNDE5NjI4MDIyOTc=