Page MenuHomePhorge
Diviner Arcanist Tech Docs PhutilExampleBufferedIterator

final class PhutilExampleBufferedIterator
Arcanist Technical Documentation ()

Example implementation and test case for PhutilBufferedIterator.

Tasks

Methods to Implement

Configuration

  • final public function getPageSize() — Get the configured page size.
  • final public function setPageSize($size) — Configure the page size. Note that implementations may ignore this.

Iterator Implementation

  • final public function current()
  • public function key() — By default, the iterator assigns a "natural" key (0, 1, 2, ...) to each result. This method is intentionally nonfinal so you can substitute a different behavior by overriding it if you prefer.
  • final public function next()
  • final public function rewind()
  • final public function valid()

Other Methods

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

final public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

PhutilBufferedIterator

By default, the iterator assigns a "natural" key (0, 1, 2, ...) to each result. This method is intentionally nonfinal so you can substitute a different behavior by overriding it if you prefer.

Return
scalarKey for the current result (as per @{method:current}).

final public function next()
Inherited

This method is not documented.
Return
wild

final public function rewind()
Inherited

This method is not documented.
Return
wild

final public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

protected function didRewind()

PhutilBufferedIterator

Called when rewind() is invoked. You should reset any internal cursor your implementation holds.

PhutilExampleBufferedIterator
This method is not documented.
Return
void

protected function loadPage()

PhutilBufferedIterator

Called when the iterator needs a page of results. You should load the next result page and update your internal cursor to point past it.

If possible, you should use getPageSize() to choose a page size.

PhutilExampleBufferedIterator
This method is not documented.
Return
list<wild>List of results.

final public function getPageSize()
Inherited

PhutilBufferedIterator

Get the configured page size.

Return
intPage size.

final public function setPageSize($size)
Inherited

PhutilBufferedIterator

Configure the page size. Note that implementations may ignore this.

Parameters
int$sizePage size.
Return
this

public function setExampleData($data)

This method is not documented.
Parameters
array$data
Return
wild

private function query($cursor, $limit)

This method is not documented.
Parameters
$cursor
$limit
Return
wild