1 | <?php |
||
70 | class FeedIo |
||
71 | { |
||
72 | |||
73 | /** |
||
74 | * @var \FeedIo\Reader |
||
75 | */ |
||
76 | protected $reader; |
||
77 | |||
78 | /** |
||
79 | * @var \FeedIo\Rule\DateTimeBuilder |
||
80 | */ |
||
81 | protected $dateTimeBuilder; |
||
82 | |||
83 | /** |
||
84 | * @var \Psr\Log\LoggerInterface |
||
85 | */ |
||
86 | protected $logger; |
||
87 | |||
88 | /** |
||
89 | * @var array |
||
90 | */ |
||
91 | protected $standards; |
||
92 | |||
93 | /** |
||
94 | * @var \FeedIo\Reader\FixerSet |
||
95 | */ |
||
96 | protected $fixerSet; |
||
97 | |||
98 | /** |
||
99 | * @param \FeedIo\Adapter\ClientInterface $client |
||
100 | * @param \Psr\Log\LoggerInterface $logger |
||
101 | */ |
||
102 | public function __construct(ClientInterface $client, LoggerInterface $logger) |
||
110 | |||
111 | /** |
||
112 | * Loads main standards (RSS, RDF, Atom) in current object's attributes |
||
113 | * |
||
114 | * @return $this |
||
115 | */ |
||
116 | protected function loadCommonStandards() |
||
125 | |||
126 | /** |
||
127 | * adds a filter to the reader |
||
128 | * |
||
129 | * @param \FeedIo\FilterInterface $filter |
||
130 | * @return $this |
||
131 | */ |
||
132 | public function addFilter(FilterInterface $filter) |
||
138 | |||
139 | /** |
||
140 | * Returns main standards |
||
141 | * |
||
142 | * @return array |
||
143 | */ |
||
144 | public function getCommonStandards() |
||
150 | |||
151 | /** |
||
152 | * @param string $name |
||
153 | * @param \FeedIo\StandardAbstract $standard |
||
154 | * @return $this |
||
155 | */ |
||
156 | public function addStandard($name, StandardAbstract $standard) |
||
165 | |||
166 | /** |
||
167 | * @param string $format |
||
168 | * @param StandardAbstract $standard |
||
169 | * @return object |
||
170 | */ |
||
171 | public function newParser($format, StandardAbstract $standard) |
||
181 | |||
182 | /** |
||
183 | * @return \FeedIo\Reader\FixerSet |
||
184 | */ |
||
185 | public function getFixerSet() |
||
189 | |||
190 | /** |
||
191 | * @return $this |
||
192 | */ |
||
193 | protected function loadFixerSet() |
||
204 | |||
205 | /** |
||
206 | * @param FixerAbstract $fixer |
||
207 | * @return $this |
||
208 | */ |
||
209 | public function addFixer(FixerAbstract $fixer) |
||
216 | |||
217 | /** |
||
218 | * @return array |
||
219 | */ |
||
220 | public function getBaseFixers() |
||
228 | |||
229 | /** |
||
230 | * @param array $formats |
||
231 | * @return $this |
||
232 | */ |
||
233 | public function addDateFormats(array $formats) |
||
241 | |||
242 | /** |
||
243 | * @return \FeedIo\Rule\DateTimeBuilder |
||
244 | */ |
||
245 | public function getDateTimeBuilder() |
||
249 | |||
250 | /** |
||
251 | * @return \FeedIo\Reader |
||
252 | */ |
||
253 | public function getReader() |
||
257 | |||
258 | /** |
||
259 | * @param \FeedIo\Reader |
||
260 | * @return $this |
||
261 | */ |
||
262 | public function setReader(Reader $reader) |
||
268 | |||
269 | /** |
||
270 | * @param $url |
||
271 | * @param FeedInterface $feed |
||
272 | * @param \DateTime $modifiedSince |
||
273 | * @return \FeedIo\Reader\Result |
||
274 | */ |
||
275 | public function read($url, FeedInterface $feed = null, \DateTime $modifiedSince = null) |
||
292 | |||
293 | /** |
||
294 | * @param $url |
||
295 | * @param \DateTime $modifiedSince |
||
296 | * @return \FeedIo\Reader\Result |
||
297 | */ |
||
298 | public function readSince($url, \DateTime $modifiedSince) |
||
302 | |||
303 | /** |
||
304 | * @return $this |
||
305 | */ |
||
306 | public function resetFilters() |
||
312 | |||
313 | /** |
||
314 | * @param FeedInterface $feed |
||
315 | * @param string $standard Standard's name |
||
316 | * @return string |
||
317 | */ |
||
318 | public function format(FeedInterface $feed, $standard) |
||
326 | |||
327 | /** |
||
328 | * @param \FeedIo\FeedInterface $feed |
||
329 | * @return string |
||
330 | */ |
||
331 | public function toRss(FeedInterface $feed) |
||
335 | |||
336 | /** |
||
337 | * @param \FeedIo\FeedInterface $feed |
||
338 | * @return string |
||
339 | */ |
||
340 | public function toAtom(FeedInterface $feed) |
||
344 | |||
345 | /** |
||
346 | * @param \FeedIo\FeedInterface $feed |
||
347 | * @return string |
||
348 | */ |
||
349 | public function toJson(FeedInterface $feed) |
||
353 | |||
354 | |||
355 | /** |
||
356 | * @param string $name |
||
357 | * @return \FeedIo\StandardAbstract |
||
358 | * @throws \OutOfBoundsException |
||
359 | */ |
||
360 | public function getStandard($name) |
||
369 | |||
370 | /** |
||
371 | * @param \FeedIo\FeedInterface $feed |
||
372 | * @param string $message |
||
373 | * @return $this |
||
374 | */ |
||
375 | protected function logAction(FeedInterface $feed, $message) |
||
382 | } |
||
383 |