Test Setup Failed
Branch master (d7bb0f)
by Mike
05:49
created
Category
src/CommandHandler.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,11 +31,10 @@
 block discarded – undo
31 31
         $baseCommand = $command->getCommand();
32 32
         $queueName = $this->implementation->getQueueNameResolver()
33 33
             ->resolveQueueName($baseCommand);
34
-        $commandId = $command->getId() ?:
35
-            $this->implementation->getCommandIdGenerator()
34
+        $commandId = $command->getId() ?: $this->implementation->getCommandIdGenerator()
36 35
                 ->generateId($baseCommand);
37 36
         $serialized = $this->implementation->getCommandSerializer()
38 37
             ->serialize($baseCommand);
39
-        return [$queueName, $commandId, $serialized];
38
+        return [ $queueName, $commandId, $serialized ];
40 39
     }
41 40
 }
Please login to merge, or discard this patch.
src/Predis/PredisAdapter.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
     public function queueCommand(string $queueName, string $id, string $serialized)
27 27
     {
28 28
         list ($isReserved) = $this->client->pipeline(
29
-            function (ClientContextInterface $client) use ($queueName, $id, $serialized) {
29
+            function(ClientContextInterface $client) use ($queueName, $id, $serialized) {
30 30
                 self::cIsCommandIdReserved($client, $queueName, $id);
31 31
                 self::cStoreCommand($client, $queueName, $id, $serialized);
32 32
             }
33 33
         );
34 34
         if (!$isReserved) {
35
-            $this->client->pipeline(function (ClientContextInterface $client) use ($queueName, $id) {
35
+            $this->client->pipeline(function(ClientContextInterface $client) use ($queueName, $id) {
36 36
                 self::cReserveCommandId($client, $queueName, $id);
37 37
                 self::cUpdateCommandStatus($client, $queueName, $id, self::STATUS_QUEUED);
38
-                $client->lpush(":{$queueName}:queue", [$id]);
38
+                $client->lpush(":{$queueName}:queue", [ $id ]);
39 39
             });
40 40
         }
41 41
     }
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
             return $this->awaitCommand($queueName, $timeout);
60 60
         }
61 61
         /* @var $id string */
62
-        list(, $serialized) = $this->client->pipeline(function (ClientContextInterface $client) use ($queueName, $id) {
62
+        list(, $serialized) = $this->client->pipeline(function(ClientContextInterface $client) use ($queueName, $id) {
63 63
             self::cUpdateCommandStatus($client, $queueName, $id, self::STATUS_IN_PROGRESS);
64 64
             self::cRetrieveCommand($client, $queueName, $id);
65
-            self::cReleaseReservedCommandIds($client, $queueName, [$id]);
65
+            self::cReleaseReservedCommandIds($client, $queueName, [ $id ]);
66 66
         });
67 67
         return new ReceivedCommand($queueName, $id, $serialized);
68 68
     }
@@ -74,21 +74,21 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function setCommandCompleted(string $queueName, string $id)
76 76
     {
77
-        $this->client->pipeline(function (ClientContextInterface $client) use ($queueName, $id) {
77
+        $this->client->pipeline(function(ClientContextInterface $client) use ($queueName, $id) {
78 78
             self::cEndCommand($client, $queueName, $id, self::STATUS_COMPLETED);
79 79
         });
80 80
     }
81 81
 
82 82
     public function setCommandFailed(string $queueName, string $id)
83 83
     {
84
-        $this->client->pipeline(function (ClientContextInterface $client) use ($queueName, $id) {
84
+        $this->client->pipeline(function(ClientContextInterface $client) use ($queueName, $id) {
85 85
             self::cEndCommand($client, $queueName, $id, self::STATUS_FAILED);
86 86
         });
87 87
     }
88 88
 
89 89
     public function putQueue(string $queueName)
90 90
     {
91
-        $this->client->pipeline(function (ClientContextInterface $client) use ($queueName) {
91
+        $this->client->pipeline(function(ClientContextInterface $client) use ($queueName) {
92 92
             self::cAddQueue($client, $queueName);
93 93
         });
94 94
     }
@@ -134,18 +134,18 @@  discard block
 block discarded – undo
134 134
 
135 135
     public function deleteQueue(string $queueName)
136 136
     {
137
-        $this->client->pipeline(function (ClientContextInterface $client) use ($queueName) {
137
+        $this->client->pipeline(function(ClientContextInterface $client) use ($queueName) {
138 138
             self::cDeleteQueue($client, $queueName);
139 139
         });
140 140
     }
141 141
 
142 142
     public function purgeCommand(string $queueName, string $id)
143 143
     {
144
-        $this->client->pipeline(function (ClientContextInterface $client) use ($queueName, $id) {
145
-            $client->hdel(":{$queueName}:command_store", [$id]);
146
-            $client->hdel(":{$queueName}:command_status", [$id]);
147
-            self::cReleaseReservedCommandIds($client, $queueName, [$id]);
148
-            $json = json_encode([$queueName, $id]);
144
+        $this->client->pipeline(function(ClientContextInterface $client) use ($queueName, $id) {
145
+            $client->hdel(":{$queueName}:command_store", [ $id ]);
146
+            $client->hdel(":{$queueName}:command_status", [ $id ]);
147
+            self::cReleaseReservedCommandIds($client, $queueName, [ $id ]);
148
+            $json = json_encode([ $queueName, $id ]);
149 149
             $client->lrem(":{$queueName}:queue", 1, $id);
150 150
             $client->lrem(":{$queueName}:consuming", 1, $id);
151 151
             $client->zrem(':schedule', $json);
@@ -155,18 +155,18 @@  discard block
 block discarded – undo
155 155
     public function scheduleCommand(string $queueName, string $id, string $serialized, \DateTime $dateTime)
156 156
     {
157 157
         list ($isReserved) = $this->client->pipeline(
158
-            function (ClientContextInterface $client) use ($queueName, $id, $serialized) {
158
+            function(ClientContextInterface $client) use ($queueName, $id, $serialized) {
159 159
                 self::cIsCommandIdReserved($client, $queueName, $id);
160 160
                 self::cStoreCommand($client, $queueName, $id, $serialized);
161 161
             }
162 162
         );
163 163
         if (!$isReserved) {
164 164
             $this->client->pipeline(
165
-                function (ClientContextInterface $client) use ($queueName, $id, $dateTime) {
165
+                function(ClientContextInterface $client) use ($queueName, $id, $dateTime) {
166 166
                     self::cReserveCommandId($client, $queueName, $id);
167 167
                     self::cUpdateCommandStatus($client, $queueName, $id, self::STATUS_SCHEDULED);
168
-                    $json = json_encode([$queueName, $id]);
169
-                    $client->zadd(':schedule', [$json => $dateTime->getTimestamp()]);
168
+                    $json = json_encode([ $queueName, $id ]);
169
+                    $client->zadd(':schedule', [ $json => $dateTime->getTimestamp() ]);
170 170
                 }
171 171
             );
172 172
         }
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
         foreach ($queueNames as $queueName) {
188 188
             $result = $this->client->zrangebyscore(':schedule', $lowScore, $highScore);
189 189
             if (!empty($result)) {
190
-                $this->client->pipeline(function (ClientContextInterface $client) use ($result, $queueName) {
191
-                    $idsToRelease = [];
190
+                $this->client->pipeline(function(ClientContextInterface $client) use ($result, $queueName) {
191
+                    $idsToRelease = [ ];
192 192
                     foreach ($result as $json => $score) {
193 193
                         list($thisQueueName, $id) = json_decode($json, true);
194 194
                         if ($thisQueueName === $queueName) {
195 195
                             $client->zrem(':schedule', $json);
196
-                            $idsToRelease[] = $id;
196
+                            $idsToRelease[ ] = $id;
197 197
                         }
198 198
                     }
199 199
                     self::cReleaseReservedCommandIds($client, $queueName, $idsToRelease);
@@ -213,21 +213,21 @@  discard block
 block discarded – undo
213 213
             $start = $startTime->getTimestamp();
214 214
         }
215 215
         $result = $this->client->zrangebyscore(':schedule', $start, $now->getTimestamp(), [
216
-            'limit' => [0, $limit],
216
+            'limit' => [ 0, $limit ],
217 217
             'withscores' => true,
218 218
         ]);
219
-        $commands = [];
220
-        if ($result !== []) {
221
-            $queueNamesById = $idsByJson = [];
219
+        $commands = [ ];
220
+        if ($result !== [ ]) {
221
+            $queueNamesById = $idsByJson = [ ];
222 222
             $pipelineReturn = $this->client->pipeline(
223
-                function (ClientContextInterface $client) use ($result, &$queueNamesById, &$idsByJson) {
224
-                    $idsByQueueName = [];
223
+                function(ClientContextInterface $client) use ($result, &$queueNamesById, &$idsByJson) {
224
+                    $idsByQueueName = [ ];
225 225
                     foreach ($result as $json => $score) {
226 226
                         list($queueName, $id) = json_decode($json, true);
227 227
                         self::cRetrieveCommand($client, $queueName, $id);
228
-                        $idsByQueueName[$queueName][] = $id;
229
-                        $queueNamesById[$id] = $queueName;
230
-                        $idsByJson[$json] = $id;
228
+                        $idsByQueueName[ $queueName ][ ] = $id;
229
+                        $queueNamesById[ $id ] = $queueName;
230
+                        $idsByJson[ $json ] = $id;
231 231
                     }
232 232
                     $client->zrem(':schedule', array_keys($result));
233 233
                     foreach ($idsByQueueName as $queueName => $ids) {
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
                 }
237 237
             );
238 238
             foreach (array_keys($result) as $index => $json) {
239
-                $id = $idsByJson[$json];
240
-                $commands[] = new ReceivedScheduledCommand(
241
-                    $queueNamesById[$id],
239
+                $id = $idsByJson[ $json ];
240
+                $commands[ ] = new ReceivedScheduledCommand(
241
+                    $queueNamesById[ $id ],
242 242
                     $id,
243
-                    $pipelineReturn[$index],
244
-                    new \DateTime('@' . $result[$json])
243
+                    $pipelineReturn[ $index ],
244
+                    new \DateTime('@'.$result[ $json ])
245 245
                 );
246 246
             }
247 247
         }
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
 
262 262
     private static function cReserveCommandId($client, string $queueName, string $id)
263 263
     {
264
-        $client->sadd(":{$queueName}:queue_ids", [$id]);
264
+        $client->sadd(":{$queueName}:queue_ids", [ $id ]);
265 265
     }
266 266
 
267 267
     private static function cEndCommand($client, string $queueName, string $id, string $status)
268 268
     {
269 269
         self::cUpdateCommandStatus($client, $queueName, $id, $status);
270
-        self::cReleaseReservedCommandIds($client, $queueName, [$id]);
271
-        $client->srem(":{$queueName}:queue_ids", [$id]);
270
+        self::cReleaseReservedCommandIds($client, $queueName, [ $id ]);
271
+        $client->srem(":{$queueName}:queue_ids", [ $id ]);
272 272
         $client->lrem(":{$queueName}:consuming", 1, $id);
273 273
     }
274 274
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
     private static function cAddQueue($client, string $queueName)
291 291
     {
292
-        $client->sadd(':queues', [$queueName]);
292
+        $client->sadd(':queues', [ $queueName ]);
293 293
     }
294 294
 
295 295
     private static function cEmptyQueue($client, string $queueName)
Please login to merge, or discard this patch.