TruncateCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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