FeedInterface.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?php
  2. namespace Drupal\aggregator;
  3. use Drupal\Core\Entity\ContentEntityInterface;
  4. /**
  5. * Provides an interface defining an aggregator feed entity.
  6. */
  7. interface FeedInterface extends ContentEntityInterface {
  8. /**
  9. * Sets the title of the feed.
  10. *
  11. * @param string $title
  12. * The short title of the feed.
  13. *
  14. * @return \Drupal\aggregator\FeedInterface
  15. * The class instance that this method is called on.
  16. */
  17. public function setTitle($title);
  18. /**
  19. * Returns the url to the feed.
  20. *
  21. * @return string
  22. * The url to the feed.
  23. */
  24. public function getUrl();
  25. /**
  26. * Sets the url to the feed.
  27. *
  28. * @param string $url
  29. * A string containing the url of the feed.
  30. *
  31. * @return \Drupal\aggregator\FeedInterface
  32. * The class instance that this method is called on.
  33. */
  34. public function setUrl($url);
  35. /**
  36. * Returns the refresh rate of the feed in seconds.
  37. *
  38. * @return int
  39. * The refresh rate of the feed in seconds.
  40. */
  41. public function getRefreshRate();
  42. /**
  43. * Sets the refresh rate of the feed in seconds.
  44. *
  45. * @param int $refresh
  46. * The refresh rate of the feed in seconds.
  47. *
  48. * @return \Drupal\aggregator\FeedInterface
  49. * The class instance that this method is called on.
  50. */
  51. public function setRefreshRate($refresh);
  52. /**
  53. * Returns the last time where the feed was checked for new items.
  54. *
  55. * @return int
  56. * The timestamp when new items were last checked for.
  57. */
  58. public function getLastCheckedTime();
  59. /**
  60. * Sets the time when this feed was queued for refresh, 0 if not queued.
  61. *
  62. * @param int $checked
  63. * The timestamp of the last refresh.
  64. *
  65. * @return \Drupal\aggregator\FeedInterface
  66. * The class instance that this method is called on.
  67. */
  68. public function setLastCheckedTime($checked);
  69. /**
  70. * Returns the time when this feed was queued for refresh, 0 if not queued.
  71. *
  72. * @return int
  73. * The timestamp of the last refresh.
  74. */
  75. public function getQueuedTime();
  76. /**
  77. * Sets the time when this feed was queued for refresh, 0 if not queued.
  78. *
  79. * @param int $queued
  80. * The timestamp of the last refresh.
  81. *
  82. * @return \Drupal\aggregator\FeedInterface
  83. * The class instance that this method is called on.
  84. */
  85. public function setQueuedTime($queued);
  86. /**
  87. * Returns the parent website of the feed.
  88. *
  89. * @return string
  90. * The parent website of the feed.
  91. */
  92. public function getWebsiteUrl();
  93. /**
  94. * Sets the parent website of the feed.
  95. *
  96. * @param string $link
  97. * A string containing the parent website of the feed.
  98. *
  99. * @return \Drupal\aggregator\FeedInterface
  100. * The class instance that this method is called on.
  101. */
  102. public function setWebsiteUrl($link);
  103. /**
  104. * Returns the description of the feed.
  105. *
  106. * @return string
  107. * The description of the feed.
  108. */
  109. public function getDescription();
  110. /**
  111. * Sets the description of the feed.
  112. *
  113. * @param string $description
  114. * The description of the feed.
  115. *
  116. * @return \Drupal\aggregator\FeedInterface
  117. * The class instance that this method is called on.
  118. */
  119. public function setDescription($description);
  120. /**
  121. * Returns the primary image attached to the feed.
  122. *
  123. * @return string
  124. * The URL of the primary image attached to the feed.
  125. */
  126. public function getImage();
  127. /**
  128. * Sets the primary image attached to the feed.
  129. *
  130. * @param string $image
  131. * An image URL.
  132. *
  133. * @return \Drupal\aggregator\FeedInterface
  134. * The class instance that this method is called on.
  135. */
  136. public function setImage($image);
  137. /**
  138. * Returns the calculated hash of the feed data, used for validating cache.
  139. *
  140. * @return string
  141. * The calculated hash of the feed data.
  142. */
  143. public function getHash();
  144. /**
  145. * Sets the calculated hash of the feed data, used for validating cache.
  146. *
  147. * @param string $hash
  148. * A string containing the calculated hash of the feed. Must contain
  149. * US ASCII characters only.
  150. *
  151. * @return \Drupal\aggregator\FeedInterface
  152. * The class instance that this method is called on.
  153. */
  154. public function setHash($hash);
  155. /**
  156. * Returns the entity tag HTTP response header, used for validating cache.
  157. *
  158. * @return string
  159. * The entity tag HTTP response header.
  160. */
  161. public function getEtag();
  162. /**
  163. * Sets the entity tag HTTP response header, used for validating cache.
  164. *
  165. * @param string $etag
  166. * A string containing the entity tag HTTP response header.
  167. *
  168. * @return \Drupal\aggregator\FeedInterface
  169. * The class instance that this method is called on.
  170. */
  171. public function setEtag($etag);
  172. /**
  173. * Return when the feed was modified last time.
  174. *
  175. * @return int
  176. * The timestamp of the last time the feed was modified.
  177. */
  178. public function getLastModified();
  179. /**
  180. * Sets the last modification of the feed.
  181. *
  182. * @param int $modified
  183. * The timestamp when the feed was modified.
  184. *
  185. * @return \Drupal\aggregator\FeedInterface
  186. * The class instance that this method is called on.
  187. */
  188. public function setLastModified($modified);
  189. /**
  190. * Deletes all items from a feed.
  191. *
  192. * This will also reset the last checked and modified time of the feed and
  193. * save it.
  194. *
  195. * @return \Drupal\aggregator\FeedInterface
  196. * The class instance that this method is called on.
  197. *
  198. * @see \Drupal\aggregator\ItemsImporterInterface::delete()
  199. */
  200. public function deleteItems();
  201. /**
  202. * Updates the feed items by triggering the import process.
  203. *
  204. * This will also update the last checked time of the feed and save it.
  205. *
  206. * @return bool
  207. * TRUE if there is new content for the feed FALSE otherwise.
  208. *
  209. * @see \Drupal\aggregator\ItemsImporterInterface::refresh()
  210. */
  211. public function refreshItems();
  212. }