WP_CLI\Iterators
CSV::next
Method of the class: CSV{}
No Hooks.
Returns
null. Nothing (null).
Usage
$CSV = new CSV(); $CSV->next();
CSV::next() CSV::next code WP-CLI 2.13.0-alpha
public function next() {
$this->current_element = false;
while ( true ) {
$row = fgetcsv( $this->file_pointer, self::ROW_SIZE, $this->delimiter, '"', '\\' );
if ( false === $row ) {
break;
}
$element = [];
foreach ( $this->columns as $i => $key ) {
if ( isset( $row[ $i ] ) ) {
$element[ $key ] = $row[ $i ];
}
}
if ( ! empty( $element ) ) {
$this->current_element = $element;
++$this->current_index;
break;
}
}
}