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:----muoRl32vH8wE0RRVQDShBBB4iitxA78tXj7YwCg8r4Jr9ej4wDgQkoOpDVXUiv6VLnxGR9hgwu43JzWGMO+1QOKl2W3x3bSOOA15nl6xAhiaq9BYAaz+kUD6dxEGYmsHHc+7VNq4CojJaGEIlHVsqBPEVflYhK7xDiapBAsXbBQHFDt/6L/pBZnateAXSkm1Su6Dpf3SukasAWB4LNU+rsj0fyyZ77z3qhmL8zqwtMJWbrQyzVCRXhWBECW8TmWG2PmVWbfQs+e9wiOGXSmmaVwEHGKKavubym/jDM6fw//72we7zb8EEWhm/oDicQorQDRiVcbg5yECby0D+2v6ANeThJMy41zvz/QtDbkgFrZ+rn1Z1umHDZcni04OqXSdSAeptRDPD2ihOwL66slx22jCMccjurKZirLuptTnk2YdgJCnCbQuH1Jc68jErbdp3J0jS7uMPXKuC6kxeNA0HZA7HmExL4XfTUlBSmEwEzAlRowmh+KyZqlHrZb90hYl5NsqzRD85O7Kun/a8aDRYuW2+W3rII2n96053POXhUOMEvwCAAPn03cqCkmX3MxHNu4uGOxjdK4soRU47GaE14vF7gCddVlwZQnHGkouJ111LG1shp1g+ZDiDYx0FjEx8uYPDOVmt8OOHBHUuB36QVeY4t7Ts0LrdWBfug++4MM=----ATTACHMENT:----MzY3NDI3NDMwMzY5MTY1OCA0MTE0MzEyODAxMTcxMTExIDg3NDA2MDM3NzYzOTEyOQ==