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