Pull merge.
[yaffs-website] / web / core / modules / aggregator / src / Plugin / ParserInterface.php
1 <?php
2
3 namespace Drupal\aggregator\Plugin;
4
5 use Drupal\aggregator\FeedInterface;
6
7 /**
8  * Defines an interface for aggregator parser implementations.
9  *
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.
15  *
16  * @see \Drupal\aggregator\Annotation\AggregatorParser
17  * @see \Drupal\aggregator\Plugin\AggregatorPluginSettingsBase
18  * @see \Drupal\aggregator\Plugin\AggregatorPluginManager
19  * @see plugin_api
20  */
21 interface ParserInterface {
22
23   /**
24    * Parses feed data.
25    *
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
44    *       the item.
45    *     - link: A full URL to the individual feed item.
46    *
47    * @return bool
48    *   TRUE if parsing was successful, FALSE otherwise.
49    */
50   public function parse(FeedInterface $feed);
51
52 }