Completed
Push — master ( 8a683b...96b103 )
by Matthew
05:26 queued 53s
created

ResetCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 19
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A execute() 0 9 1
1
<?php
2
3
namespace Dtc\QueueBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class ResetCommand extends ContainerAwareCommand
10
{
11 1
    protected function configure()
12
    {
13 1
        $this
14 1
            ->setName('dtc:queue:reset')
15 1
            ->setDescription('Reset jobs with error or stalled status');
16 1
    }
17
18 1
    protected function execute(InputInterface $input, OutputInterface $output)
19
    {
20 1
        $container = $this->getContainer();
21 1
        $jobManager = $container->get('dtc_queue.job_manager');
22 1
        $countError = $jobManager->resetErroneousJobs();
23 1
        $countStalled = $jobManager->resetStalledJobs();
24 1
        $output->writeln("$countError job(s) in status 'error' reset");
25 1
        $output->writeln("$countStalled job(s) in status 'running' reset");
26 1
    }
27
}
28