Skip to content

Commit b6dc82f

Browse files
authored
Merge pull request #26 from solverat/null_limit
Allow null as limit value
2 parents 91d0686 + cc3e32d commit b6dc82f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/Data/Criteria.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Criteria implements ParseAware
3737

3838
private int $page;
3939

40-
private int $limit;
40+
private ?int $limit;
4141

4242
/**
4343
* Don't use term parameters together with query parameters.
@@ -84,7 +84,7 @@ class Criteria implements ParseAware
8484

8585
private array $includes = [];
8686

87-
public function __construct(int $page = 1, int $limit = 25)
87+
public function __construct(int $page = 1, ?int $limit = 25)
8888
{
8989
$this->page = $page;
9090
$this->limit = $limit;
@@ -307,9 +307,7 @@ public function parse(): array
307307
$params['page'] = $this->page;
308308
}
309309

310-
if ($this->limit) {
311-
$params['limit'] = $this->limit;
312-
}
310+
$params['limit'] = $this->limit;
313311

314312
if ($this->term !== null) {
315313
$params['term'] = $this->term;
@@ -391,12 +389,12 @@ public function setPage(int $page): void
391389
$this->page = $page;
392390
}
393391

394-
public function getLimit(): int
392+
public function getLimit(): ?int
395393
{
396394
return $this->limit;
397395
}
398396

399-
public function setLimit(int $limit): void
397+
public function setLimit(?int $limit): void
400398
{
401399
$this->limit = $limit;
402400
}

0 commit comments

Comments
 (0)