1 | <?php |
||
14 | class IronMqDriver extends AbstractPrefetchDriver |
||
15 | { |
||
16 | protected $ironmq; |
||
17 | |||
18 | /** |
||
19 | * @param IronMQ $ironmq |
||
20 | * @param int|null $prefetch |
||
21 | */ |
||
22 | public function __construct(IronMQ $ironmq, $prefetch = null) |
||
23 | { |
||
24 | parent::__construct($prefetch); |
||
25 | |||
26 | $this->ironmq = $ironmq; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function listQueues() |
||
33 | { |
||
34 | $queueNames = array(); |
||
35 | $page = 0; |
||
36 | |||
37 | while ($queues = $this->ironmq->getQueues($page, 100)) { |
||
38 | $queueNames += $this->pluck($queues, 'name'); |
||
39 | |||
40 | // If we get 100 results the probability of another page is high. |
||
41 | if (count($queues) < 100) { |
||
42 | break; |
||
43 | } |
||
44 | |||
45 | $page++; |
||
46 | } |
||
47 | |||
48 | return $queueNames; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | public function createQueue($queueName, array $options = []) |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function countMessages($queueName) |
||
62 | { |
||
63 | if ($info = $this->ironmq->getQueue($queueName)) { |
||
64 | return $info->size; |
||
65 | } |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function pushMessage($queueName, $message, array $options = []) |
||
72 | { |
||
73 | $options = $this->validatePushOptions($options); |
||
74 | |||
75 | $this->ironmq->postMessage($queueName, $message, $options); |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function popMessage($queueName, $duration = 5) |
||
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | */ |
||
105 | public function acknowledgeMessage($queueName, $receipt) |
||
109 | |||
110 | /** |
||
111 | * IronMQ does not support an offset when peeking messages. |
||
112 | * |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | public function peekQueue($queueName, $index = 0, $limit = 20) |
||
116 | { |
||
117 | if ($messages = $this->ironmq->peekMessages($queueName, $limit)) { |
||
118 | return $this->pluck($messages, 'body'); |
||
119 | } |
||
120 | |||
121 | return []; |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * {@inheritdoc} |
||
126 | */ |
||
127 | public function removeQueue($queueName) |
||
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | public function info() |
||
136 | { |
||
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | public function configurePushOptions(OptionsResolver $resolver) |
||
164 | |||
165 | /** |
||
166 | * The missing array_pluck but for objects array |
||
167 | * |
||
168 | * @param array $objects |
||
169 | * @param string $property |
||
170 | * |
||
171 | * @return array |
||
172 | */ |
||
173 | protected function pluck(array $objects, $property) |
||
181 | } |
||
182 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.