Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scriptotek#21: Add setter for pagination of SimplePaginatedList #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
#21: Add setter for pagination of SimplePaginatedList
ctgraham committed Nov 16, 2020
commit 5915df1b83c86f4fc31ad075e99e61ecd03433fc
15 changes: 15 additions & 0 deletions src/Model/SimplePaginatedList.php
Original file line number Diff line number Diff line change
@@ -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 ((int)$limit < 0 || (int)$limit > 100) {
throw new \RuntimeException('Invalid limit value (0 - 100): '.$limit);
}
$this->limit = (int) $limit;
}

}