Skip to content

Commit

Permalink
Fix offset value. (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed May 13, 2023
1 parent a4aff63 commit 88647e1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/AbstractIteratorDataDataProvider.php
Expand Up @@ -53,12 +53,11 @@ public function withLimit(int $value): static
public function withOffset(int $value): static
{
$new = clone $this;
$new->offset = $value;

// validate offset
if ($new->limit * ($new->offset - 1) <= 0) {
$new->offset = self::DEFAULT_OFFSET;
}
$new->offset = match ($new->limit * ($value - 1) <= 0) {

Check warning on line 57 in src/AbstractIteratorDataDataProvider.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ public function withOffset(int $value) : static { $new = clone $this; - $new->offset = match ($new->limit * ($value - 1) <= 0) { + $new->offset = match ($new->limit * ($value - 0) <= 0) { true => self::DEFAULT_OFFSET, default => $new->limit * ($value - 1), };

Check warning on line 57 in src/AbstractIteratorDataDataProvider.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.2-ubuntu-latest

Escaped Mutant for Mutator "LessThanOrEqualTo": --- Original +++ New @@ @@ public function withOffset(int $value) : static { $new = clone $this; - $new->offset = match ($new->limit * ($value - 1) <= 0) { + $new->offset = match ($new->limit * ($value - 1) < 0) { true => self::DEFAULT_OFFSET, default => $new->limit * ($value - 1), };
true => self::DEFAULT_OFFSET,
default => $new->limit * ($value - 1),
};

return $new;
}
Expand Down

0 comments on commit 88647e1

Please sign in to comment.