1 | <?php |
||
12 | class SourceRevisitor |
||
13 | { |
||
14 | /** |
||
15 | * @var SourceManagerInterface |
||
16 | */ |
||
17 | protected $sourceManager; |
||
18 | |||
19 | /** |
||
20 | * @var ScraperFactory |
||
21 | */ |
||
22 | protected $factory; |
||
23 | |||
24 | /** |
||
25 | * Array of cached scrapers. |
||
26 | * |
||
27 | * @var Scraper[] |
||
28 | */ |
||
29 | protected $scrapers = []; |
||
30 | |||
31 | /** |
||
32 | * @param SourceManagerInterface $sourceManager |
||
33 | * @param ScraperFactory $factory |
||
34 | */ |
||
35 | public function __construct(SourceManagerInterface $sourceManager, ScraperFactory $factory) |
||
40 | |||
41 | /** |
||
42 | * Revisits a source. This basically means doing a scrape operation on the |
||
43 | * source origin, only this time the source will be removed if the original |
||
44 | * url was not found. |
||
45 | * |
||
46 | * @param SourceInterface $source The source to revisit. |
||
47 | * @param bool $async If true, makes the scrape action asynchronous. |
||
48 | * The revisit action will happen right away, but any |
||
49 | * consecutive scrape actions will be queued. Use this |
||
50 | * when calling the revisit action from an asynchronous |
||
51 | * context. |
||
52 | * @param bool $disableLimit Whether to disable the rate limit when revisiting. |
||
53 | */ |
||
54 | public function revisit(SourceInterface $source, $async = false, $disableLimit = false) |
||
74 | |||
75 | /** |
||
76 | * Does a non-blocking revisit operation. Depending on the implementation, |
||
77 | * this will mean adding a revisit job to some sort of queueing system. |
||
78 | * |
||
79 | * @param SourceInterface $source |
||
80 | * @param \DateTime $date |
||
81 | */ |
||
82 | public function revisitAfter(SourceInterface $source, \DateTime $date) |
||
91 | |||
92 | /** |
||
93 | * @param SourceInterface $source |
||
94 | */ |
||
95 | protected function removeSource(SourceInterface $source) |
||
100 | |||
101 | /** |
||
102 | * @param ScraperEntity $scraperEntity |
||
103 | * @param bool $disableLimit |
||
104 | * |
||
105 | * @return ScraperInterface |
||
106 | */ |
||
107 | protected function createScraper(ScraperEntity $scraperEntity, $disableLimit = false) |
||
124 | |||
125 | /** |
||
126 | * Checks whether the given source is fresh, meaning it doesn't need revisiting right now. |
||
127 | * |
||
128 | * @param SourceInterface $source |
||
129 | * |
||
130 | * @return bool |
||
131 | */ |
||
132 | protected function isFresh(SourceInterface $source) |
||
146 | } |
||
147 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: