protected function JmesPathLinesParser::setUp in Feeds extensible parsers 8
Allows subclasses to prepare for parsing.
Parameters
\Drupal\feeds\FeedInterface $feed: The feed we are parsing for.
\Drupal\feeds\Result\FetcherResultInterface $fetcher_result: The result of the fetching stage.
\Drupal\feeds\StateInterface $state: The state object.
Overrides ParserBase::setUp
File
- src/
Feeds/ Parser/ JmesPathLinesParser.php, line 41
Class
- JmesPathLinesParser
- Defines a JSON Lines parser using JMESPath.
Namespace
Drupal\feeds_ex\Feeds\ParserCode
protected function setUp(FeedInterface $feed, FetcherResultInterface $fetcher_result, StateInterface $state) {
parent::setUp($feed, $fetcher_result, $state);
$this->iterator = new LineIterator($fetcher_result
->getFilePath());
if (!$this->iterator
->getSize()) {
throw new EmptyFeedException();
}
$this->iterator
->setLineLimit($this->configuration['line_limit']);
if (!$state->total) {
$state->total = $this->iterator
->getSize();
}
$this->iterator
->setStartPosition((int) $state->pointer);
}