3 namespace Drupal\aggregator\Plugin;
5 use Drupal\aggregator\FeedInterface;
8 * Defines an interface for aggregator parser implementations.
10 * A parser converts feed item data to a common format. The parser is called
11 * at the second of the three aggregation stages: first, data is downloaded
12 * by the active fetcher; second, it is converted to a common format by the
13 * active parser; and finally, it is passed to all active processors which
14 * manipulate or store the data.
16 * @see \Drupal\aggregator\Annotation\AggregatorParser
17 * @see \Drupal\aggregator\Plugin\AggregatorPluginSettingsBase
18 * @see \Drupal\aggregator\Plugin\AggregatorPluginManager
21 interface ParserInterface {
26 * @param \Drupal\aggregator\FeedInterface $feed
27 * An object describing the resource to be parsed.
28 * $feed->source_string->value contains the raw feed data. Parse the data
29 * and add the following properties to the $feed object:
30 * - description: The human-readable description of the feed.
31 * - link: A full URL that directly relates to the feed.
32 * - image: An image URL used to display an image of the feed.
33 * - etag: An entity tag from the HTTP header used for cache validation to
34 * determine if the content has been changed.
35 * - modified: The UNIX timestamp when the feed was last modified.
36 * - items: An array of feed items. The common format for a single feed item
37 * is an associative array containing:
38 * - title: The human-readable title of the feed item.
39 * - description: The full body text of the item or a summary.
40 * - timestamp: The UNIX timestamp when the feed item was last published.
41 * - author: The author of the feed item.
42 * - guid: The global unique identifier (GUID) string that uniquely
43 * identifies the item. If not available, the link is used to identify
45 * - link: A full URL to the individual feed item.
48 * TRUE if parsing was successful, FALSE otherwise.
50 public function parse(FeedInterface $feed);