Code Duplication    Length = 12-16 lines in 2 locations

src/TreeHouse/WorkerBundle/Queue.php 1 location

@@ 227-242 (lines=16) @@
224
     *
225
     * @throws InvalidArgumentException When `$date` is in the past
226
     */
227
    public function reschedule(Job $job, \DateTime $date, $priority = PheanstalkInterface::DEFAULT_PRIORITY)
228
    {
229
        if ($date < new \DateTime()) {
230
            throw new InvalidArgumentException(
231
                sprintf(
232
                    'You cannot reschedule a job in the past (got %s, and the current date is %s)',
233
                    $date->format(DATE_ISO8601),
234
                    date(DATE_ISO8601)
235
                )
236
            );
237
        }
238
239
        $this->pheanstalk->release($job, $priority, $date->getTimestamp() - time());
240
241
        $this->logJob($job->getId(), sprintf('Rescheduled job for %s', $date->format('Y-m-d H:i:s')));
242
    }
243
244
    /**
245
     * @param string|string[] $actions

src/TreeHouse/WorkerBundle/QueueManager.php 1 location

@@ 315-326 (lines=12) @@
312
     *
313
     * @throws \InvalidArgumentException When `$date` is in the past
314
     */
315
    public function reschedule(Job $job, \DateTime $date, $priority = PheanstalkInterface::DEFAULT_PRIORITY)
316
    {
317
        if ($date < new \DateTime()) {
318
            throw new \InvalidArgumentException(
319
                sprintf('You cannot reschedule a job in the past (got %s, and the current date is %s)', $date->format(DATE_ISO8601), date(DATE_ISO8601))
320
            );
321
        }
322
323
        $this->pheanstalk->release($job, $priority, $date->getTimestamp() - time());
324
325
        $this->logJob($job->getId(), sprintf('Rescheduled job for %s', $date->format('Y-m-d H:i:s')));
326
    }
327
328
    /**
329
     * @param string|string[] $actions