You are here

public function FeedsAtomRDFParser::parse in Feeds Atom 7

Same name and namespace in other branches
  1. 6 plugins/FeedsAtomRDFParser.inc \FeedsAtomRDFParser::parse()

Implementation of FeedsParser::parse().

File

plugins/FeedsAtomRDFParser.inc, line 17
Contains the feeds atom RDF parser class.

Class

FeedsAtomRDFParser
Parses Atom RDF feeds.

Code

public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
  require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'feeds_atom') . '/libraries/atomrdf_parser.inc';
  $result = new FeedsParserResult();
  $raw = atomrdf_parser_parse($fetcher_result
    ->getRaw());

  // @todo, probably a better way to do this transfer from array to object.
  $attributes = array(
    'items',
    'description',
    'link',
    'title',
  );
  foreach ($attributes as $attribute) {
    if (!empty($raw[$attribute])) {
      $result->{$attribute} = $raw[$attribute];
    }
  }
  return $result;
}