mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-02 19:52:44 +01:00
23786784ef
Summary: Adds the Balanced PHP API to externals/. Ref T2787. Test Plan: Used in next diff. Reviewers: btrahan, chad Reviewed By: chad CC: aran, aurelijus Maniphest Tasks: T2787 Differential Revision: https://secure.phabricator.com/D5764
37 lines
623 B
PHP
37 lines
623 B
PHP
<?php
|
|
|
|
namespace RESTful;
|
|
|
|
class PaginationIterator implements \Iterator
|
|
{
|
|
public function __construct($resource, $uri, $data = null)
|
|
{
|
|
$this->_page = new Page($resource, $uri, $data);
|
|
}
|
|
|
|
// Iterator
|
|
public function current()
|
|
{
|
|
return $this->_page;
|
|
}
|
|
|
|
public function key()
|
|
{
|
|
return $this->_page->index;
|
|
}
|
|
|
|
public function next()
|
|
{
|
|
$this->_page = $this->_page->next();
|
|
}
|
|
|
|
public function rewind()
|
|
{
|
|
$this->_page = $this->_page->first();
|
|
}
|
|
|
|
public function valid()
|
|
{
|
|
return $this->_page != null;
|
|
}
|
|
}
|