Skip to content

Commit

Permalink
Merge pull request #2 from AppsDevTeam/fixed-offset
Browse files Browse the repository at this point in the history
Enable fixed offset
  • Loading branch information
thorewi authored Jan 8, 2025
2 parents 20b5601 + cf0cffa commit 35cc3e5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/AbstractFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ abstract class AbstractFetcher implements \Iterator {

protected $offset;

protected $disableOffset = false;

/**
* @var array
*/
Expand All @@ -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;
Expand All @@ -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();
}
}
Expand Down

0 comments on commit 35cc3e5

Please sign in to comment.