You are here

protected function FeedsExJsonPathLines::setUp in Feeds extensible parsers 7

Same name and namespace in other branches
  1. 7.2 src/FeedsExJsonPathLines.inc \FeedsExJsonPathLines::setUp()

Allows subclasses to prepare for parsing.

Parameters

FeedsSource $source: The feed source.

FeedsFetcherResult $fetcher_result: The result of the fetching stage.

Overrides FeedsExBase::setUp

File

src/FeedsExJsonPathLines.inc, line 30
Contains FeedsExJsonPathLines.

Class

FeedsExJsonPathLines
Parses the JSON Lines format via JSONPath.

Code

protected function setUp(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
  $this->iterator = new FeedsExLineIterator($fetcher_result
    ->getFilePath());
  if (!$this->iterator
    ->getSize()) {
    throw new FeedsExEmptyException();
  }
  $this->iterator
    ->setLineLimit($source->importer
    ->getLimit());
  $state = $source
    ->state(FEEDS_PARSE);
  if (!$state->total) {
    $state->total = $this->iterator
      ->getSize();
  }
  $this->iterator
    ->setStartPosition((int) $state->pointer);
}