3b138338da1d08c68420a4425db6c354abb8bc56
[yaffs-website] / web / core / modules / aggregator / src / Plugin / ProcessorInterface.php
1 <?php
2
3 namespace Drupal\aggregator\Plugin;
4
5 use Drupal\aggregator\FeedInterface;
6
7 /**
8  * Defines an interface for aggregator processor implementations.
9  *
10  * A processor acts on parsed feed data. Active processors are called at the
11  * third and last of the aggregation stages: first, data is downloaded by the
12  * active fetcher; second, it is converted to a common format by the active
13  * parser; and finally, it is passed to all active processors that manipulate or
14  * store the data.
15  *
16  * @see \Drupal\aggregator\Annotation\AggregatorProcessor
17  * @see \Drupal\aggregator\Plugin\AggregatorPluginSettingsBase
18  * @see \Drupal\aggregator\Plugin\AggregatorPluginManager
19  * @see plugin_api
20  */
21 interface ProcessorInterface {
22
23   /**
24    * Processes feed data.
25    *
26    * @param \Drupal\aggregator\FeedInterface $feed
27    *   A feed object representing the resource to be processed.
28    *   $feed->items contains an array of feed items downloaded and parsed at the
29    *   parsing stage. See \Drupal\aggregator\Plugin\FetcherInterface::parse()
30    *   for the basic format of a single item in the $feed->items array.
31    *   For the exact format refer to the particular parser in use.
32    */
33   public function process(FeedInterface $feed);
34
35   /**
36    * Refreshes feed information.
37    *
38    * Called after the processing of the feed is completed by all selected
39    * processors.
40    *
41    * @param \Drupal\aggregator\FeedInterface $feed
42    *   Object describing feed.
43    *
44    * @see aggregator_refresh()
45    */
46   public function postProcess(FeedInterface $feed);
47
48   /**
49    * Deletes stored feed data.
50    *
51    * Called by aggregator if either a feed is deleted or a user clicks on
52    * "delete items".
53    *
54    * @param \Drupal\aggregator\FeedInterface $feed
55    *   The $feed object whose items are being deleted.
56    */
57   public function delete(FeedInterface $feed);
58
59 }