diff --git a/src/AbstractFetcher.php b/src/AbstractFetcher.php index 8f20a08..62d12dd 100644 --- a/src/AbstractFetcher.php +++ b/src/AbstractFetcher.php @@ -22,6 +22,8 @@ abstract class AbstractFetcher implements \Iterator { protected $offset; + protected $disableOffset = false; + /** * @var array */ @@ -32,6 +34,11 @@ public function __construct($batch = 100) $this->limit = $batch; } + public function disableOffset(): self { + $this->disableOffset = true; + return $this; + } + public function rewind(): void { $this->offset = 0; @@ -58,7 +65,9 @@ public function next(): void if ($this->dataIndex === $this->limit) { // maybe we have more data - $this->offset += $this->limit; // next bulk + if (!$this->disableOffset) { + $this->offset += $this->limit; // next bulk + } $this->fetch(); } }