Code Duplication    Length = 26-27 lines in 3 locations

Command/QueueDeleteCommand.php 1 location

@@ 19-45 (lines=27) @@
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
class QueueDeleteCommand extends ContainerAwareCommand
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    protected function configure()
25
    {
26
        $this
27
            ->setName('jobqueue:delete')
28
            ->setDescription('Delete a queue')
29
            ->addArgument('queue-name', InputArgument::REQUIRED, 'Which name do you want for the queue?')
30
        ;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38
        $queue = $this->getContainer()->get('jobqueue');
39
        $name = $input->getArgument('queue-name');
40
41
        if ($queue->delete($name)) {
42
            $output->writeLn(sprintf('<info>Queue "%s" deleted</info>', $name));
43
        }
44
    }
45
}
46

Command/QueueForgetCommand.php 1 location

@@ 19-44 (lines=26) @@
16
use Symfony\Component\Console\Input\InputOption;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
class QueueForgetCommand extends ContainerAwareCommand
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    protected function configure()
25
    {
26
        $this
27
            ->setName('jobqueue:forget')
28
            ->setDescription('Retrying Failed Jobs')
29
            ->addOption('record', null, InputOption::VALUE_NONE, 'Id of failed message to forget');
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output)
36
    {
37
        $queue = $this->getContainer()->get('jobqueue');
38
        $id = $input->getArgument('id');
39
40
        if ($queue->forget($id)) {
41
            $output->writeLn(sprintf('<info>Forgotten message %s</info>', $id));
42
        }
43
    }
44
}
45

Command/QueueRetryCommand.php 1 location

@@ 19-45 (lines=27) @@
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
class QueueRetryCommand extends ContainerAwareCommand
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    protected function configure()
25
    {
26
        $this
27
            ->setName('jobqueue:retry')
28
            ->setDescription('Retrying Failed Jobs')
29
            ->addArgument('queue-name', InputArgument::REQUIRED, 'Which name do you want for the queue?')
30
        ;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38
        $queue = $this->getContainer()->get('jobqueue');
39
        $name = $input->getArgument('queue-name');
40
41
        if ($queue->retry($name)) {
42
            $output->writeLn(sprintf('<info>Retried failed jobs for %s deleted</info>', $name));
43
        }
44
    }
45
}
46