Completed
Push — master ( 692985...e555b8 )
by Matthew
18:05
created

ResetCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 22
ccs 12
cts 12
cp 1
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setJobManager() 0 2 1
A execute() 0 6 1
A configure() 0 5 1
1
<?php
2
3
namespace Dtc\QueueBundle\Command;
4
5
use Dtc\QueueBundle\Manager\JobManagerInterface;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class ResetCommand extends Command
11 1
{
12
    /** @var JobManagerInterface */
13
    private $jobManager;
14 1
15 1
    protected function configure()
16 1
    {
17
        $this
18 1
            ->setName('dtc:queue:reset')
19
            ->setDescription('Reset jobs with exception or stalled status');
20 1
    }
21 1
22 1
    public function setJobManager($jobManager) {
23 1
        $this->jobManager = $jobManager;
24 1
    }
25 1
26 1
    protected function execute(InputInterface $input, OutputInterface $output)
27
    {
28
        $countException = $this->jobManager->resetExceptionJobs();
29
        $countStalled = $this->jobManager->resetStalledJobs();
0 ignored issues
show
Bug introduced by
The method resetStalledJobs() does not exist on Dtc\QueueBundle\Manager\JobManagerInterface. It seems like you code against a sub-type of Dtc\QueueBundle\Manager\JobManagerInterface such as Dtc\QueueBundle\Manager\StallableJobManager. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
        /** @scrutinizer ignore-call */ 
30
        $countStalled = $this->jobManager->resetStalledJobs();
Loading history...
30
        $output->writeln("$countException job(s) in status 'exception' reset");
31
        $output->writeln("$countStalled job(s) stalled (in status 'running') reset");
32
    }
33
}
34