DeleteTask::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
3
namespace JobQueue\Application\Console;
4
5
use JobQueue\Application\Utils\CommandTrait;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
final class DeleteTask extends ManagerCommand
11
{
12
    use CommandTrait;
13
14
    public function configure()
15
    {
16
        $this
17
            ->setName('delete')
18
            ->setDescription('Delete a task')
19
            ->addArgument('identifier', InputArgument::REQUIRED, 'Task UUID identifier')
20
        ;
21
    }
22
23
    /**
24
     *
25
     * @param InputInterface $input
26
     * @param OutputInterface $output
27
     * @return int
28
     */
29
    protected function execute(InputInterface $input, OutputInterface $output): int
30
    {
31
        $identifier = $input->getArgument('identifier');
32
33
        $this->queue->delete($identifier);
34
35
        $this->formatInfoSection(sprintf('Task %s deleted', $identifier), $output);
36
37
        return 0;
38
    }
39
}
40