コード例 #1
0
ファイル: Pagination.php プロジェクト: starweb/starlit-app
 /**
  * Magic method called when object is called as a function.
  *
  * @param int   $currentPageNo
  * @param int   $rowsPerPage
  * @param int   $totalRowCount
  * @param array $options
  * @return Paginator
  */
 public function __invoke($currentPageNo, $rowsPerPage, $totalRowCount, array $options = [])
 {
     if (!$this->view || !$this->view->getRequest()) {
         throw new \LogicException('View request is required for this view helper');
     }
     $paginator = new Paginator($currentPageNo, $rowsPerPage, $totalRowCount, $this->view->getRequest(), $options);
     return $paginator->getHtml();
 }
コード例 #2
0
 public function testGetHtmlUrlGenerator()
 {
     $paginator = new Paginator(1, 10, 20, function ($page) {
         return 'http://example.org/some-page.html?page=' . $page;
     });
     $html = $paginator->getHtml();
     $this->assertContains('href="http://example.org/some-page.html?page=1"', $html);
     $this->assertContains('href="http://example.org/some-page.html?page=2"', $html);
 }