You are here

protected function FeedsCSVParser::parseItems in Feeds 7.2

Same name and namespace in other branches
  1. 6 plugins/FeedsCSVParser.inc \FeedsCSVParser::parseItems()
  2. 7 plugins/FeedsCSVParser.inc \FeedsCSVParser::parseItems()

Parse all of the items from the CSV.

Parameters

ParserCSV $parser:

ParserCSVIterator $iterator:

int $start: The byte number from where to start parsing the file.

int $limit: The number of lines to parse, 0 for all lines.

Return value

array An array of rows of the CSV keyed by the column names previously set.

1 call to FeedsCSVParser::parseItems()
FeedsCSVParser::parse in plugins/FeedsCSVParser.inc
Implements FeedsParser::parse().

File

plugins/FeedsCSVParser.inc, line 102
Contains the FeedsCSVParser class.

Class

FeedsCSVParser
Parses a given file as a CSV file.

Code

protected function parseItems(ParserCSV $parser, ParserCSVIterator $iterator, $start = 0, $limit = 0) {
  try {
    $parser
      ->setLineLimit($limit);
    $parser
      ->setStartByte($start);
    $rows = $parser
      ->parse($iterator);
    return $rows;
  } catch (Exception $e) {

    // Make sure that the file on the iterator gets properly closed when
    // exceptions occur during parsing.
    $iterator
      ->releaseHandler();
    throw $e;
  }
}