namespace WPForms\Logger;
class Records implements Countable, Iterator {
private $iterator_position = 0;
* Return the current element.
* @return \WPForms\Logger\Record|null Return null when no items in collection.
public function current() {
return $this->valid() ? $this->list[ $this->iterator_position ] : null;
* Move forward to next element.
++ $this->iterator_position;
* Return the key of the current element.
return $this->iterator_position;
* Checks if current position is valid.
public function valid() {
return isset( $this->list[ $this->iterator_position ] );
* Rewind the Iterator to the first element.
public function rewind() {
$this->iterator_position = 0;
* Count number of Record in a Queue.
public function count() {
return count( $this->list );
* @param \WPForms\Logger\Record $record Record.
public function push( $record ) {
if ( ! is_a( $record, '\WPForms\Logger\Record' ) ) {
public function clear() {
$this->iterator_position = 0;