/** * Returns an array of "local" pages given a page number and range. * * @param Paginator $paginator * @param int $pageRange Unused * @return array */ public function getPages(Paginator $paginator, $pageRange = null) { $pageRange = $paginator->getPageRange(); $pageNumber = $paginator->getCurrentPageNumber(); $delta = $pageNumber % $pageRange; if ($delta == 0) { $delta = $pageRange; } $offset = $pageNumber - $delta; $lowerBound = $offset + 1; $upperBound = $offset + $pageRange; return $paginator->getPagesInRange($lowerBound, $upperBound); }
public function testGetsPagesInOutOfBoundsRange() { $actual = $this->paginator->getPagesInRange(-1, 12); $this->assertEquals(array_combine(range(1, 11), range(1, 11)), $actual); }
/** * Returns an array of all pages given a page number and range. * * @param Paginator $paginator * @param int $pageRange Unused * @return array */ public function getPages(Paginator $paginator, $pageRange = null) { return $paginator->getPagesInRange(1, $paginator->count()); }