Passed
Push — master ( 055b76...bacc0b )
by Patrick
01:33 queued 12s
created

QueueClientConsumerConsoleCommandPlugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of forecast.it.fill project.
7
 * (c) Patrick Jaja <[email protected]>
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace ForecastAutomation\QueueClient\Shared\Plugin;
13
14
use ForecastAutomation\Kernel\Shared\Plugin\AbstractCommandPlugin;
15
use Symfony\Component\Console\Input\InputArgument;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
/**
20
 * @method \ForecastAutomation\QueueClient\QueueClientFacade getFacade()
21
 */
22
class QueueClientConsumerConsoleCommandPlugin extends AbstractCommandPlugin
23
{
24
    public const COMMAND_NAME = 'queue:client:consumer';
25
    public const DESCRIPTION = 'This command will consume messages in topics and call related processors.';
26
    public const ARGUMENT_QUEUE_NAME = 'queue_name';
27
28
    protected function configure(): void
29
    {
30
        $this->setName(self::COMMAND_NAME);
31
        $this->setDescription(self::DESCRIPTION);
32
        $this->addArgument(self::ARGUMENT_QUEUE_NAME, InputArgument::REQUIRED, 'Please add one of your registered Queue Plugins (QueuePluginCollection) as an argument.');
33
34
        parent::configure();
35
    }
36
37
    protected function execute(InputInterface $input, OutputInterface $output): int
38
    {
39
        $this->getFacade()->consume($input->getArgument(self::ARGUMENT_QUEUE_NAME));
40
41
        return self::SUCCESS;
42
    }
43
}
44