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

ResetCommand::setJobManager()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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