TruncateCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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