EventQueueWorkerStartCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jellyfish\Event\Command;
6
7
use Jellyfish\Event\EventQueueWorkerInterface;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class EventQueueWorkerStartCommand extends Command
13
{
14
    public const NAME = 'event:queue-worker:start';
15
    public const DESCRIPTION = 'Start event queue worker';
16
17
    /**
18
     * @var \Jellyfish\Event\EventQueueWorkerInterface $eventQueueWorker
19
     */
20
    protected $eventQueueWorker;
21
22
    /**
23
     * @param \Jellyfish\Event\EventQueueWorkerInterface $eventQueueWorker
24
     */
25
    public function __construct(
26
        EventQueueWorkerInterface $eventQueueWorker
27
    ) {
28
        parent::__construct();
29
30
        $this->eventQueueWorker = $eventQueueWorker;
31
    }
32
33
    /**
34
     * @return void
35
     */
36
    protected function configure(): void
37
    {
38
        parent::configure();
39
40
        $this->setName(static::NAME);
41
        $this->setDescription(static::DESCRIPTION);
42
    }
43
44
    /**
45
     * @param \Symfony\Component\Console\Input\InputInterface $input
46
     * @param \Symfony\Component\Console\Output\OutputInterface $output
47
     *
48
     * @return int|null
49
     */
50
    protected function execute(InputInterface $input, OutputInterface $output): ?int
51
    {
52
        $this->eventQueueWorker->start();
53
54
        return null;
55
    }
56
}
57