for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Zenstruck\Porpaginas;
/**
* @author Kevin Bond <[email protected]>
*/
abstract class Pager implements \Countable
{
* @return int|null
final public function getNextPage()
$currentPage = $this->getCurrentPage();
if ($currentPage === $this->getLastPage()) {
return null;
}
return ++$currentPage;
final public function getPreviousPage()
$page = $this->getCurrentPage();
if ($page === 1) {
return --$page;
* @return int
final public function getFirstPage()
return 1;
final public function getLastPage()
$totalCount = $this->totalCount();
if ($totalCount === 0) {
return (int) ceil($totalCount / $this->getLimit());
final public function pagesCount()
return $this->getLastPage();
abstract public function getCurrentPage();
abstract public function getLimit();
* The result count for the current page.
*
abstract public function count();
* The total result count.
abstract public function totalCount();
* @return Page
abstract public function getResults();