1 | <?php declare(strict_types=1); |
||
76 | class FeedIo |
||
77 | { |
||
78 | |||
79 | /** |
||
80 | * @var \FeedIo\Reader |
||
81 | */ |
||
82 | protected $reader; |
||
83 | |||
84 | /** |
||
85 | * @var \FeedIo\Rule\DateTimeBuilder |
||
86 | */ |
||
87 | protected $dateTimeBuilder; |
||
88 | |||
89 | /** |
||
90 | * @var \FeedIo\Adapter\ClientInterface; |
||
91 | */ |
||
92 | protected $client; |
||
93 | |||
94 | /** |
||
95 | * @var \Psr\Log\LoggerInterface |
||
96 | */ |
||
97 | protected $logger; |
||
98 | |||
99 | /** |
||
100 | * @var array |
||
101 | */ |
||
102 | protected $standards; |
||
103 | |||
104 | /** |
||
105 | * @var \FeedIo\Reader\FixerSet |
||
106 | */ |
||
107 | protected $fixerSet; |
||
108 | |||
109 | /** |
||
110 | * @param \FeedIo\Adapter\ClientInterface $client |
||
111 | * @param \Psr\Log\LoggerInterface $logger |
||
112 | */ |
||
113 | 12 | public function __construct(ClientInterface $client, LoggerInterface $logger, DateTimeBuilderInterface $dateTimeBuilder = null) |
|
122 | |||
123 | /** |
||
124 | * Loads main standards (RSS, RDF, Atom) in current object's attributes |
||
125 | * |
||
126 | * @return FeedIo |
||
127 | */ |
||
128 | 12 | protected function loadCommonStandards() : FeedIo |
|
137 | |||
138 | /** |
||
139 | * adds a filter to the reader |
||
140 | * |
||
141 | * @param \FeedIo\FilterInterface $filter |
||
142 | * @return FeedIo |
||
143 | */ |
||
144 | 2 | public function addFilter(FilterInterface $filter) : FeedIo |
|
150 | |||
151 | /** |
||
152 | * Returns main standards |
||
153 | * |
||
154 | * @return array |
||
155 | */ |
||
156 | 12 | public function getCommonStandards() : array |
|
162 | |||
163 | /** |
||
164 | * @param string $name |
||
165 | * @param \FeedIo\StandardAbstract $standard |
||
166 | * @return FeedIo |
||
167 | */ |
||
168 | 12 | public function addStandard(string $name, StandardAbstract $standard) : FeedIo |
|
177 | |||
178 | /** |
||
179 | * @param string $format |
||
180 | * @param StandardAbstract $standard |
||
181 | * @return ParserAbstract |
||
182 | */ |
||
183 | 11 | public function newParser(string $format, StandardAbstract $standard) : ParserAbstract |
|
193 | |||
194 | /** |
||
195 | * @return \FeedIo\Reader\FixerSet |
||
196 | */ |
||
197 | 1 | public function getFixerSet() : FixerSet |
|
201 | |||
202 | /** |
||
203 | * @return FeedIo |
||
204 | */ |
||
205 | 11 | protected function loadFixerSet() : FeedIo |
|
216 | |||
217 | /** |
||
218 | * @param FixerAbstract $fixer |
||
219 | * @return FeedIo |
||
220 | */ |
||
221 | 11 | public function addFixer(FixerAbstract $fixer) : FeedIo |
|
228 | |||
229 | /** |
||
230 | * @return array |
||
231 | */ |
||
232 | 11 | public function getBaseFixers() : array |
|
241 | |||
242 | /** |
||
243 | * @param array $formats |
||
244 | * @return FeedIo |
||
245 | */ |
||
246 | public function addDateFormats(array $formats) : FeedIo |
||
247 | { |
||
248 | foreach ($formats as $format) { |
||
249 | $this->getDateTimeBuilder()->addDateFormat($format); |
||
250 | } |
||
251 | |||
252 | return $this; |
||
253 | } |
||
254 | |||
255 | /** |
||
256 | * @return \FeedIo\Rule\DateTimeBuilder |
||
257 | */ |
||
258 | 12 | public function getDateTimeBuilder() : DateTimeBuilder |
|
262 | |||
263 | /** |
||
264 | * @return \FeedIo\Reader |
||
265 | */ |
||
266 | 4 | public function getReader() : Reader |
|
270 | |||
271 | /** |
||
272 | * @param \FeedIo\Reader $reader |
||
273 | * @return FeedIo |
||
274 | */ |
||
275 | 12 | public function setReader(Reader $reader) : FeedIo |
|
281 | |||
282 | /** |
||
283 | * Discover feeds from the webpage's headers |
||
284 | * @param string $url |
||
285 | * @return array |
||
286 | */ |
||
287 | 1 | public function discover(string $url) : array |
|
293 | |||
294 | /** |
||
295 | * @param iterable $requests |
||
296 | * @param CallbackInterface $callback |
||
297 | * @param string $feedClass |
||
298 | */ |
||
299 | public function readAsync(iterable $requests, CallbackInterface $callback, string $feedClass = '\FeedIo\Feed') : void |
||
305 | |||
306 | /** |
||
307 | * @param string $url |
||
308 | * @param FeedInterface $feed |
||
309 | * @param \DateTime $modifiedSince |
||
310 | * @return \FeedIo\Reader\Result |
||
311 | */ |
||
312 | 2 | public function read(string $url, FeedInterface $feed = null, \DateTime $modifiedSince = null) : Result |
|
330 | |||
331 | /** |
||
332 | * @param string $url |
||
333 | * @param \DateTime $modifiedSince |
||
334 | * @return \FeedIo\Reader\Result |
||
335 | */ |
||
336 | 1 | public function readSince(string $url, \DateTime $modifiedSince) : Result |
|
340 | |||
341 | /** |
||
342 | * @return FeedIo |
||
343 | */ |
||
344 | 2 | public function resetFilters() : FeedIo |
|
350 | |||
351 | /** |
||
352 | * Get a PSR-7 compliant response for the given feed |
||
353 | * |
||
354 | * @param \FeedIo\FeedInterface $feed |
||
355 | * @param string $standard |
||
356 | * @param int $maxAge |
||
357 | * @param bool $public |
||
358 | * @return ResponseInterface |
||
359 | */ |
||
360 | 1 | public function getPsrResponse(FeedInterface $feed, string $standard, int $maxAge = 600, bool $public = true) : ResponseInterface |
|
369 | |||
370 | /** |
||
371 | * @param FeedInterface $feed |
||
372 | * @param string $standard Standard's name |
||
373 | * @return string |
||
374 | */ |
||
375 | 1 | public function format(FeedInterface $feed, string $standard) : string |
|
383 | |||
384 | /** |
||
385 | * @param \FeedIo\FeedInterface $feed |
||
386 | * @return string |
||
387 | */ |
||
388 | 1 | public function toRss(FeedInterface $feed) : string |
|
392 | |||
393 | /** |
||
394 | * @param \FeedIo\FeedInterface $feed |
||
395 | * @return string |
||
396 | */ |
||
397 | 1 | public function toAtom(FeedInterface $feed) : string |
|
401 | |||
402 | /** |
||
403 | * @param \FeedIo\FeedInterface $feed |
||
404 | * @return string |
||
405 | */ |
||
406 | 1 | public function toJson(FeedInterface $feed) : string |
|
410 | |||
411 | |||
412 | /** |
||
413 | * @param string $name |
||
414 | * @return \FeedIo\StandardAbstract |
||
415 | * @throws \OutOfBoundsException |
||
416 | */ |
||
417 | 3 | public function getStandard(string $name) : StandardAbstract |
|
426 | |||
427 | /** |
||
428 | * @param \FeedIo\FeedInterface $feed |
||
429 | * @param string $message |
||
430 | * @return FeedIo |
||
431 | */ |
||
432 | 3 | protected function logAction(FeedInterface $feed, string $message) : FeedIo |
|
439 | } |
||
440 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.