Passed
Push — v2 ( c4de3c...f057b3 )
by Brice
03:43
created

ShowTask   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 28
ccs 5
cts 10
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 9 1
A configure() 0 6 1
1
<?php
2
3
namespace JobQueue\Application\Console;
4
5
use JobQueue\Application\Utils\CommandTrait;
6
use JobQueue\Infrastructure\ServiceContainer;
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
final class ShowTask extends Command
13
{
14
    use CommandTrait;
15
16
    public function configure()
17
    {
18
        $this
19
            ->setName('show')
20
            ->setDescription('Show a task information')
21
            ->addArgument('identifier', InputArgument::REQUIRED, 'Task UUID identifier')
22
        ;
23
    }
24
25
    /**
26
     *
27
     * @param InputInterface $input
28
     * @param OutputInterface $output
29
     * @return int
30
     */
31 1
    protected function execute(InputInterface $input, OutputInterface $output): int
32
    {
33 1
        $queue = ServiceContainer::getInstance()->queue;
34
35 1
        $task = $queue->find($input->getArgument('identifier'));
36
37 1
        $this->formatTaskBlock($task, $output);
38
39 1
        return 0;
40
    }
41
}
42