示例#1
0
 public function __construct(PageInput $input)
 {
     $currentPage = (int) $input->getPage() > 0 ? (int) $input->getPage() : 1;
     $numItemsPerPage = (int) $input->getPerPage() > 0 ? (int) $input->getPerPage() : 10;
     $offset = ($currentPage - 1) * $numItemsPerPage;
     $last = $offset + $numItemsPerPage - 1;
     $this->offset = $offset;
     $this->last = $last;
     $this->numItems = $numItemsPerPage;
     $this->currentPage = $currentPage;
 }
示例#2
0
 public function testExceedingMaxPerPage()
 {
     $input = new PageInput(1, 1000);
     $input->setMaxItems(200);
     $this->assertSame(200, $input->getPerPage());
 }