class RepeatedFieldIter
RepeatedFieldIter is used to iterate RepeatedField. It is also need for the foreach syntax.
Hierarchy
- class \Google\Protobuf\Internal\RepeatedFieldIter implements \Google\Protobuf\Internal\Iterator
Expanded class hierarchy of RepeatedFieldIter
File
-
vendor/
google/ protobuf/ src/ Google/ Protobuf/ Internal/ RepeatedFieldIter.php, line 21
Namespace
Google\Protobuf\InternalView source
class RepeatedFieldIter implements \Iterator {
/**
* @ignore
*/
private $position;
/**
* @ignore
*/
private $container;
/**
* Create iterator instance for RepeatedField.
*
* @param array $container
* @ignore
*/
public function __construct($container) {
$this->position = 0;
$this->container = $container;
}
/**
* Reset the status of the iterator
*
* @return void
* @todo need to add return type void (require update php version to 7.1)
*/
public function rewind() {
$this->position = 0;
}
/**
* Return the element at the current position.
*
* @return object The element at the current position.
* @todo need to add return type mixed (require update php version to 8.0)
*/
public function current() {
return $this->container[$this->position];
}
/**
* Return the current position.
*
* @return integer The current position.
* @todo need to add return type mixed (require update php version to 8.0)
*/
public function key() {
return $this->position;
}
/**
* Move to the next position.
*
* @return void
* @todo need to add return type void (require update php version to 7.1)
*/
public function next() {
++$this->position;
}
/**
* Check whether there are more elements to iterate.
*
* @return bool True if there are more elements to iterate.
*/
public function valid() : bool {
return isset($this->container[$this->position]);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
RepeatedFieldIter::$container | private | property | @ignore |
RepeatedFieldIter::$position | private | property | @ignore |
RepeatedFieldIter::current | public | function | Return the element at the current position. |
RepeatedFieldIter::key | public | function | Return the current position. |
RepeatedFieldIter::next | public | function | Move to the next position. |
RepeatedFieldIter::rewind | public | function | Reset the status of the iterator |
RepeatedFieldIter::valid | public | function | Check whether there are more elements to iterate. |
RepeatedFieldIter::__construct | public | function | Create iterator instance for RepeatedField. |