1 | <?php |
||
45 | abstract class AbstractQueueManager implements |
||
46 | QueueManagerInterface, |
||
47 | LoggerAwareInterface |
||
48 | { |
||
49 | use LoggerAwareTrait; |
||
50 | |||
51 | /** |
||
52 | * The queue processing rate (throttle), in items per second. |
||
53 | * |
||
54 | * @var integer |
||
55 | */ |
||
56 | private $rate = 0; |
||
57 | |||
58 | /** |
||
59 | * The batch limit. |
||
60 | * |
||
61 | * @var integer |
||
62 | */ |
||
63 | private $limit = 0; |
||
64 | |||
65 | /** |
||
66 | * The queue ID. |
||
67 | * |
||
68 | * If set, then it will load only the items from this queue. |
||
69 | * If NULL, load *all* queued items. |
||
70 | * |
||
71 | * @var mixed |
||
72 | */ |
||
73 | private $queueId; |
||
74 | |||
75 | /** |
||
76 | * The callback routine when an item is processed (whether resolved or rejected). |
||
77 | * |
||
78 | * @var callable $itemCallback |
||
79 | */ |
||
80 | private $itemCallback; |
||
81 | |||
82 | /** |
||
83 | * The callback routine when the item is resolved. |
||
84 | * |
||
85 | * @var callable $itemSuccessCallback |
||
86 | */ |
||
87 | private $itemSuccessCallback; |
||
88 | |||
89 | /** |
||
90 | * The callback routine when the item is rejected. |
||
91 | * |
||
92 | * @var callable $itemFailureCallback |
||
93 | */ |
||
94 | private $itemFailureCallback; |
||
95 | |||
96 | /** |
||
97 | * The callback routine when the queue is processed. |
||
98 | * |
||
99 | * @var callable $processedCallback |
||
100 | */ |
||
101 | private $processedCallback; |
||
102 | |||
103 | /** |
||
104 | * @var FactoryInterface $queueItemFactory |
||
105 | */ |
||
106 | private $queueItemFactory; |
||
107 | |||
108 | /** |
||
109 | * Construct new queue manager. |
||
110 | * |
||
111 | * @param array $data Dependencies and settings. |
||
112 | */ |
||
113 | public function __construct(array $data = []) |
||
126 | |||
127 | /** |
||
128 | * Set the manager's data. |
||
129 | * |
||
130 | * @param array $data The queue data to set. |
||
131 | * @return AbstractQueueManager Chainable |
||
132 | */ |
||
133 | public function setData(array $data) |
||
141 | |||
142 | /** |
||
143 | * Set the queue's ID. |
||
144 | * |
||
145 | * @param mixed $id The unique queue identifier. |
||
146 | * @return self |
||
147 | */ |
||
148 | public function setQueueId($id) |
||
153 | |||
154 | /** |
||
155 | * Get the queue's ID. |
||
156 | * |
||
157 | * @return mixed |
||
158 | */ |
||
159 | public function queueId() |
||
163 | |||
164 | /** |
||
165 | * @param integer $rate The throttling / processing rate, in items per second. |
||
166 | * @return self |
||
167 | */ |
||
168 | public function setRate($rate) |
||
173 | |||
174 | /** |
||
175 | * @return integer |
||
176 | */ |
||
177 | public function rate() |
||
181 | |||
182 | /** |
||
183 | * @param integer $limit The maximum number of items to load. |
||
184 | * @return self |
||
185 | */ |
||
186 | public function setLimit($limit) |
||
191 | |||
192 | /** |
||
193 | * @return integer |
||
194 | */ |
||
195 | public function limit() |
||
199 | |||
200 | /** |
||
201 | * Set the callback routine when an item is processed. |
||
202 | * |
||
203 | * @param callable $callback A item callback routine. |
||
204 | * @return self |
||
205 | */ |
||
206 | public function setItemCallback(callable $callback) |
||
211 | |||
212 | /** |
||
213 | * Set the callback routine when the item is resolved. |
||
214 | * |
||
215 | * @param callable $callback A item callback routine. |
||
216 | * @return self |
||
217 | */ |
||
218 | public function setItemSuccessCallback(callable $callback) |
||
223 | |||
224 | /** |
||
225 | * Set the callback routine when the item is rejected. |
||
226 | * |
||
227 | * @param callable $callback A item callback routine. |
||
228 | * @return self |
||
229 | */ |
||
230 | public function setItemFailureCallback(callable $callback) |
||
235 | |||
236 | /** |
||
237 | * Set the callback routine when the queue is processed. |
||
238 | * |
||
239 | * @param callable $callback A queue callback routine. |
||
240 | * @return self |
||
241 | */ |
||
242 | public function setProcessedCallback(callable $callback) |
||
247 | |||
248 | /** |
||
249 | * Process the items of the queue. |
||
250 | * |
||
251 | * If no callback is passed and a self::$processedCallback is set, the latter is used. |
||
252 | * |
||
253 | * @param callable $callback An optional alternative callback routine executed |
||
254 | * after all queue items are processed. |
||
255 | * @return boolean Success / Failure |
||
256 | */ |
||
257 | public function processQueue(callable $callback = null) |
||
298 | |||
299 | /** |
||
300 | * Retrieve the items of the current queue. |
||
301 | * |
||
302 | * @return \Charcoal\Model\Collection|array |
||
303 | */ |
||
304 | public function loadQueueItems() |
||
342 | |||
343 | /** |
||
344 | * Retrieve the queue item's model. |
||
345 | * |
||
346 | * @return QueueItemInterface |
||
347 | */ |
||
348 | abstract public function queueItemProto(); |
||
349 | |||
350 | /** |
||
351 | * @return FactoryInterface |
||
352 | */ |
||
353 | protected function queueItemFactory() |
||
357 | |||
358 | /** |
||
359 | * @param FactoryInterface $factory The factory used to create queue items. |
||
360 | * @return self |
||
361 | */ |
||
362 | private function setQueueItemFactory(FactoryInterface $factory) |
||
367 | } |
||
368 |
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: