Completed
Push — master ( d39b35...b61033 )
by Alexandre
02:49
created

QueueForgetCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 5
dl 26
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 7 7 1
A execute() 9 9 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/**
4
 * This file is part of HeriJobQueueBundle.
5
 *
6
 * (c) Alexandre Mogère
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Heri\Bundle\JobQueueBundle\Command;
13
14
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Input\InputOption;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19 View Code Duplication
class QueueForgetCommand extends ContainerAwareCommand
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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