You are here

protected function FeedsExJsonPathLines::setUp in Feeds extensible parsers 7.2

Same name and namespace in other branches
  1. 7 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 37
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());
  $this->iterator
    ->setLineLimit($source->importer
    ->getLimit());
  $state = $source
    ->state(FEEDS_PARSE);
  if (!$state->total) {
    $state->total = $this->iterator
      ->getSize();
  }
  $state->start = $state->pointer ? $state->pointer : 0;
  $this->iterator
    ->setStartPosition($state->start);
}