You are here

public function CsvParser::next in Feeds 8.3

Implements \Iterator::next().

1 call to CsvParser::next()
CsvParser::rewind in src/Component/CsvParser.php
Implements \Iterator::rewind().

File

src/Component/CsvParser.php, line 214

Class

CsvParser
Parses an RFC 4180 style CSV file.

Namespace

Drupal\feeds\Component

Code

public function next() {

  // Record the file position before reading the next line since we
  // preemptively read lines to avoid returning empty rows.
  $this->filePosition = ftell($this->handle);
  do {
    $line = $this
      ->readLine();

    // End of file.
    if ($line === FALSE) {
      $this->currentLine = FALSE;
      return;
    }

    // Skip empty lines that aren't wrapped in an enclosure.
  } while (!strlen(rtrim($line, "\r\n")));
  $this->currentLine = $this
    ->parseLine($line);
  $this->linesRead++;
}