protected function FeedsExJmesPathLines::setUp in Feeds extensible parsers 7
Same name and namespace in other branches
- 7.2 src/FeedsExJmesPathLines.inc \FeedsExJmesPathLines::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/
FeedsExJmesPathLines.inc, line 30 - Contains FeedsExJmesPathLines.
Class
- FeedsExJmesPathLines
- Parses JSON Lines documents with JMESPath.
Code
protected function setUp(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
parent::setUp($source, $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);
}