Skip to content

Commit

Permalink
Simplify IterableDataReader $limit property
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Nov 17, 2020
1 parent 211b044 commit dae0aa0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Reader/Iterable/IterableDataReader.php
Expand Up @@ -37,7 +37,7 @@ class IterableDataReader implements DataReaderInterface
protected iterable $data;
private ?Sort $sort = null;
private ?FilterInterface $filter = null;
private ?int $limit = null;
private int $limit = 0;
private int $offset = 0;

private array $filterProcessors = [];
Expand Down Expand Up @@ -146,7 +146,7 @@ public function read(): array

foreach ($sortedData as $item) {
// do not return more than limit items
if ($this->limit !== null && count($data) === $this->limit) {
if ($this->limit > 0 && count($data) === $this->limit) {
break;
}

Expand Down

0 comments on commit dae0aa0

Please sign in to comment.