KickCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 13
c 1
b 0
f 1
dl 0
loc 24
ccs 0
cts 18
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 11 1
A configure() 0 8 1
1
<?php
2
3
namespace Tarantool\JobQueue\Console\Command;
4
5
use Symfony\Component\Console\Input\InputArgument;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class KickCommand extends Command
10
{
11
    protected function configure(): void
12
    {
13
        parent::configure();
14
15
        $this
16
            ->setName('kick')
17
            ->setDescription('Kicks buried tasks back to the queue')
18
            ->addArgument('count', InputArgument::REQUIRED)
19
        ;
20
    }
21
22
    protected function execute(InputInterface $input, OutputInterface $output): void
23
    {
24
        $queue = $this->createConfigFactory($input, $output)->createQueue();
25
        $count = $input->getArgument('count');
26
27
        $affected = $queue->kick($count);
0 ignored issues
show
Bug introduced by
$count of type null|string|string[] is incompatible with the type integer expected by parameter $count of Tarantool\Queue\Queue::kick(). ( Ignorable by Annotation )

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

27
        $affected = $queue->kick(/** @scrutinizer ignore-type */ $count);
Loading history...
28
29
        $output->writeln(sprintf(
30
            '<comment>%d</comment> tasks were successfully kicked back to <info>%s</info>.',
31
            $affected,
32
            $queue->getName()
33
        ));
34
    }
35
}
36