You are here

protected function FeedsExBase::delegateParsing in Feeds extensible parsers 7.2

Delegates parsing to the subclass.

Parameters

FeedsSource $source: The feed source.

FeedsFetcherResult $fetcher_result: The fetcher result.

Return value

FeedsParserResult The populated parser result.

Throws

FeedsExEmptyException Thrown if the feed is empty.

Exception Thrown if an error occured during parsing.

1 call to FeedsExBase::delegateParsing()
FeedsExBase::parse in src/FeedsExBase.inc

File

src/FeedsExBase.inc, line 233
Contains FeedsExBase.

Class

FeedsExBase
The Feeds extensible parser.

Code

protected function delegateParsing(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
  $result = new FeedsParserResult();

  // Set link.
  $fetcher_config = $source
    ->getConfigFor($source->importer->fetcher);
  $result->link = is_string($fetcher_config['source']) ? $fetcher_config['source'] : '';
  $expressions = $this
    ->prepareExpressions();
  $variable_map = $this
    ->prepareVariables($expressions);
  $this
    ->setUp($source, $fetcher_result);
  foreach ($this
    ->executeContext($source, $fetcher_result) as $row) {
    if ($item = $this
      ->executeSources($row, $expressions, $variable_map)) {
      $result->items[] = $item;
    }
  }
  $this
    ->cleanUp($source, $result);
  return $result;
}