protected function JsonPathLinesParser::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/ JsonPathLinesParser.php, line 40
Class
- JsonPathLinesParser
- Defines a JSON Lines parser using JSONPath.
Namespace
Drupal\feeds_ex\Feeds\ParserCode
protected function setUp(FeedInterface $feed, FetcherResultInterface $fetcher_result, StateInterface $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);
}