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