Code Duplication    Length = 7-7 lines in 2 locations

src/Queue.php 2 locations

@@ 154-160 (lines=7) @@
151
        }
152
153
        $completeQuery = ['earliestGet' => ['$lte' => new \MongoDate()]];
154
        foreach ($query as $key => $value) {
155
            if (!is_string($key)) {
156
                throw new \InvalidArgumentException('key in $query was not a string');
157
            }
158
159
            $completeQuery["payload.{$key}"] = $value;
160
        }
161
162
        $resetTimestamp = time() + $runningResetDuration;
163
        //ints overflow to floats
@@ 229-235 (lines=7) @@
226
            $totalQuery['earliestGet'] = [$key => new \MongoDate()];
227
        }
228
229
        foreach ($query as $key => $value) {
230
            if (!is_string($key)) {
231
                throw new \InvalidArgumentException('key in $query was not a string');
232
            }
233
234
            $totalQuery["payload.{$key}"] = $value;
235
        }
236
237
        return $this->collection->count($totalQuery);
238
    }