for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Netdudes\DataSourceryBundle\Query;
/**
* Defines a status of pagination
*/
class Pagination
{
* Default pagination count (elements per page)
const DEFAULT_COUNT = 20;
* The page
*
* @var int
private $page;
* Elements per page
private $count;
* Calculated: page * count
private $offset;
* @param $page int 0-indexed page
* @param $count int Items per page
public function __construct($page = 0, $count = self::DEFAULT_COUNT)
$this->page = $page;
$this->count = $count > 0 ? $count : self::DEFAULT_COUNT;
// The item offset form the beginning of the item collection
$this->offset = $page * $count;
}
* @return mixed
public function getOffset()
return $this->offset;
public function getPage()
return $this->page;
* @param int $page
public function setPage($page)
$this->offset = $this->page * $this->count;
public function getCount()
return $this->count;
* @param int $count
public function setCount($count)