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:----LY54GXJgZTuNCBDBEZNR93VaC/2rTg3/e+C9QFP3KwLTLULm2NXi52paJJ6Qn6e8Cv1oyxBS/Shg+Mmgzxmerk8JjgJUKQGEQIbjKRWHPUPf5GE3tCyAhJJJNSkATfAR2cb24Xc22/6aRhLK6CXtgSlXcBic0ZIpowbUON13GHIAHKvCXRSjGqk+pQKYqXfqcbKMzuStC4Lktyt2QtkeMPSST5DIRnWxlOmBr5EWmwGgclGEqRL6jlSAk1gNiIPG3emzgbYMk9C5B0eMpQh7SlTMdXhp53XvC3fUsQiX1sT4YJQVasokt/kar9V8NUupZNrr67aMYmKxlnb2Wow+AGwG3CddmCfCC3UKe+/8C6fwT9yOx0hXbKEHXFlyLIEtpo+oiyb5vqrqXMBsAgD/vQAFQ66pbTwt6SnOl+hIxa1wa4ziZ6ZC3gRkJPbBMGxw/P1P8yMZKJSpUJoqLzQd2jztTN43voDo6HZ8M+K1GFAitoad580YS4cUHPp8aYjUITXF5JEaVdS2NlrrtKKfqR9q9+3kAFLrVc1PobBg0kLTgQtxhm+aKN72EF/FiA1OD8X2pSxfiBNjJtmbpw2S193kBMD9q32oAH/dVoRg+d77RYbIwN8Fw5yFlOehcTWmC7BG/mC9JIKU0nqeAam2yYrCuHxDfFPOT8rWBwa5Ivc=----ATTACHMENT:----NjEwNTEzOTU5MzQ3NzE3OCA3NzAyMTgyNjMyNDk3MzEzIDkyNzE2MzE3MzU0NjE4OTM=