getCurrentPage() публичный метод

Returns the current page.
public getCurrentPage ( ) : integer
Результат integer
Пример #1
0
 public function testPagerGetterMethodsShouldReturnExpectedValues()
 {
     // stub paginate
     $paginate = new stdClass();
     $paginate->total_pages = 20;
     $paginate->current = 10;
     $paginate->last = 20;
     $paginate->total_items = 100;
     $paginate->first = 1;
     $paginate->before = $paginate->current - 1;
     $paginate->next = $paginate->current + 1;
     $paginate->items = new \ArrayIterator([1, 2, 4, 5]);
     $mock = Mockery::mock(self::BUILDER_CLASS);
     $mock->shouldReceive('getPaginate')->once()->andReturn($paginate);
     $mock->shouldReceive('getLimit')->once()->andReturn(null);
     $pager = new Pager($mock, ['rangeLength' => 5, 'urlMask' => 'xxx']);
     $this->assertEquals($paginate->current, $pager->getCurrentPage());
     $this->assertEquals($paginate->total_items, $pager->count());
     $this->assertEquals(1, $pager->getFirstPage());
     $this->assertTrue($pager->haveToPaginate());
     $this->assertEquals($paginate->before, $pager->getPreviousPage());
     $this->assertEquals($paginate->next, $pager->getNextPage());
     $this->assertInstanceOf('Iterator', $pager->getIterator());
 }
Пример #2
-1
 /**
  * @link https://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Pager/Layout.php#L406
  * @param  array  $options
  * @return string
  */
 protected function parseUrlTemplate(array $options = [])
 {
     $str = '';
     // If given page is the current active one
     if ($options['page_number'] == $this->pager->getCurrentPage()) {
         $str = $this->parseMaskReplacements($this->selectedTemplate);
     }
     // Possible attempt where Selected == Template
     if ($str == '') {
         $str = $this->parseMaskReplacements($this->template);
     }
     return $str;
 }