Completed
Push — master ( a1f77e...f1bc3f )
by Matthew
04:51
created

ResetCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 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
        $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