Skip to content

Commit

Permalink
scriptotek#21: add mutator for pagination limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ctgraham committed Oct 30, 2020
1 parent e4a4c1e commit f6e6151
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Model/SimplePaginatedList.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,19 @@ public function count()

return $this->totalRecordCount;
}

/**
* Mutate the pagination limit
*
* @param int $limit Maximum number of items per page (0 - 100)
* @throws \RuntimeException
*/
public function setPaginationLimit($limit)
{
if ($limit < 0 || $limit > 100) {
throw new RuntimeException('Invalid limit value (0 - 100): '.$limit);
}
$this->limit = $limit;
}

}

0 comments on commit f6e6151

Please sign in to comment.