1 | <?php |
||
73 | class FeedIo |
||
74 | { |
||
75 | |||
76 | /** |
||
77 | * @var \FeedIo\Reader |
||
78 | */ |
||
79 | protected $reader; |
||
80 | |||
81 | /** |
||
82 | * @var \FeedIo\Rule\DateTimeBuilder |
||
83 | */ |
||
84 | protected $dateTimeBuilder; |
||
85 | |||
86 | /** |
||
87 | * @var \Psr\Log\LoggerInterface |
||
88 | */ |
||
89 | protected $logger; |
||
90 | |||
91 | /** |
||
92 | * @var array |
||
93 | */ |
||
94 | protected $standards; |
||
95 | |||
96 | /** |
||
97 | * @var \FeedIo\Reader\FixerSet |
||
98 | */ |
||
99 | protected $fixerSet; |
||
100 | |||
101 | /** |
||
102 | * @param \FeedIo\Adapter\ClientInterface $client |
||
103 | * @param \Psr\Log\LoggerInterface $logger |
||
104 | */ |
||
105 | 10 | public function __construct(ClientInterface $client, LoggerInterface $logger) |
|
113 | |||
114 | /** |
||
115 | * Loads main standards (RSS, RDF, Atom) in current object's attributes |
||
116 | * |
||
117 | * @return $this |
||
118 | */ |
||
119 | 10 | protected function loadCommonStandards() |
|
128 | |||
129 | /** |
||
130 | * adds a filter to the reader |
||
131 | * |
||
132 | * @param \FeedIo\FilterInterface $filter |
||
133 | * @return $this |
||
134 | */ |
||
135 | 2 | public function addFilter(FilterInterface $filter) |
|
141 | |||
142 | /** |
||
143 | * Returns main standards |
||
144 | * |
||
145 | * @return array |
||
146 | */ |
||
147 | 10 | public function getCommonStandards() |
|
156 | |||
157 | /** |
||
158 | * @param string $name |
||
159 | * @param \FeedIo\StandardAbstract $standard |
||
160 | * @return $this |
||
161 | */ |
||
162 | 10 | public function addStandard($name, StandardAbstract $standard) |
|
171 | |||
172 | /** |
||
173 | * @param string $format |
||
174 | * @param StandardAbstract $standard |
||
175 | * @return object |
||
176 | */ |
||
177 | 9 | public function newParser($format, StandardAbstract $standard) |
|
187 | |||
188 | /** |
||
189 | * @return \FeedIo\Reader\FixerSet |
||
190 | */ |
||
191 | 1 | public function getFixerSet() |
|
195 | |||
196 | /** |
||
197 | * @return $this |
||
198 | */ |
||
199 | 9 | protected function loadFixerSet() |
|
210 | |||
211 | /** |
||
212 | * @param FixerAbstract $fixer |
||
213 | * @return $this |
||
214 | */ |
||
215 | 9 | public function addFixer(FixerAbstract $fixer) |
|
222 | |||
223 | /** |
||
224 | * @return array |
||
225 | */ |
||
226 | 9 | public function getBaseFixers() |
|
234 | |||
235 | /** |
||
236 | * @param array $formats |
||
237 | * @return $this |
||
238 | */ |
||
239 | 1 | public function addDateFormats(array $formats) |
|
247 | |||
248 | /** |
||
249 | * @return \FeedIo\Rule\DateTimeBuilder |
||
250 | */ |
||
251 | 2 | public function getDateTimeBuilder() |
|
255 | |||
256 | /** |
||
257 | * @return \FeedIo\Reader |
||
258 | */ |
||
259 | 4 | public function getReader() |
|
263 | |||
264 | /** |
||
265 | * @param \FeedIo\Reader |
||
266 | * @return $this |
||
267 | */ |
||
268 | 10 | public function setReader(Reader $reader) |
|
274 | |||
275 | /** |
||
276 | * @param $url |
||
277 | * @param FeedInterface $feed |
||
278 | * @param \DateTime $modifiedSince |
||
279 | * @return \FeedIo\Reader\Result |
||
280 | */ |
||
281 | 2 | public function read($url, FeedInterface $feed = null, \DateTime $modifiedSince = null) |
|
298 | |||
299 | /** |
||
300 | * @param $url |
||
301 | * @param \DateTime $modifiedSince |
||
302 | * @return \FeedIo\Reader\Result |
||
303 | */ |
||
304 | 1 | public function readSince($url, \DateTime $modifiedSince) |
|
308 | |||
309 | /** |
||
310 | * @return $this |
||
311 | */ |
||
312 | 1 | public function resetFilters() |
|
318 | |||
319 | /** |
||
320 | * @param FeedInterface $feed |
||
321 | * @param string $standard Standard's name |
||
322 | * @return \DomDocument |
||
323 | */ |
||
324 | 1 | public function format(FeedInterface $feed, $standard) |
|
332 | |||
333 | /** |
||
334 | * @param \FeedIo\FeedInterface $feed |
||
335 | * @return \DomDocument |
||
336 | */ |
||
337 | 1 | public function toRss(FeedInterface $feed) |
|
341 | |||
342 | /** |
||
343 | * @param \FeedIo\FeedInterface $feed |
||
344 | * @return \DomDocument |
||
345 | */ |
||
346 | 1 | public function toAtom(FeedInterface $feed) |
|
350 | |||
351 | /** |
||
352 | * @param string $name |
||
353 | * @return \FeedIo\StandardAbstract |
||
354 | * @throws \OutOfBoundsException |
||
355 | */ |
||
356 | 2 | public function getStandard($name) |
|
365 | |||
366 | /** |
||
367 | * @param \FeedIo\FeedInterface $feed |
||
368 | * @param string $message |
||
369 | * @return $this |
||
370 | */ |
||
371 | 2 | protected function logAction(FeedInterface $feed, $message) |
|
378 | } |
||
379 |