TruncateCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 6 1
A configure() 0 7 1
1
<?php
2
3
namespace Tarantool\JobQueue\Console\Command;
4
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
class TruncateCommand extends Command
9
{
10
    protected function configure(): void
11
    {
12
        parent::configure();
13
14
        $this
15
            ->setName('truncate')
16
            ->setDescription('Deletes all tasks from the queue')
17
        ;
18
    }
19
20
    protected function execute(InputInterface $input, OutputInterface $output): void
21
    {
22
        $queue = $this->createConfigFactory($input, $output)->createQueue();
23
        $queue->truncate();
24
25
        $output->writeln(sprintf('<info>%s</info> was successfully truncated.', $queue->getName()));
26
    }
27
}
28