Code Duplication    Length = 7-7 lines in 2 locations

src/Queue.php 2 locations

@@ 165-171 (lines=7) @@
162
        );
163
164
        $completeQuery = ['running' => false];
165
        foreach ($query as $key => $value) {
166
            if (!is_string($key)) {
167
                throw new \InvalidArgumentException('key in $query was not a string');
168
            }
169
170
            $completeQuery["payload.{$key}"] = $value;
171
        }
172
173
        $completeQuery['earliestGet'] = ['$lte' => new \MongoDB\BSON\UTCDateTime(microtime(true) * 1000)];
174
@@ 243-249 (lines=7) @@
240
            $totalQuery['running'] = $running;
241
        }
242
243
        foreach ($query as $key => $value) {
244
            if (!is_string($key)) {
245
                throw new \InvalidArgumentException('key in $query was not a string');
246
            }
247
248
            $totalQuery["payload.{$key}"] = $value;
249
        }
250
251
        return $this->collection->count($totalQuery);
252
    }