Passed
Push — master ( 0fb020...8e97d3 )
by Joachim
02:40
created

DispatchCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 70%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 23
ccs 7
cts 10
cp 0.7
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A execute() 0 5 1
A configure() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\MessageSchedulerBundle\Command;
6
7
use Setono\MessageSchedulerBundle\Dispatcher\DispatcherInterface;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
final class DispatchCommand extends Command
13
{
14
    protected static $defaultName = 'setono:message-scheduler:dispatch';
15
16
    private DispatcherInterface $dispatcher;
17
18 1
    public function __construct(DispatcherInterface $dispatcher)
19
    {
20 1
        parent::__construct();
21
22 1
        $this->dispatcher = $dispatcher;
23 1
    }
24
25 1
    protected function configure(): void
26
    {
27 1
        $this->setDescription('Will dispatch messages, that are eligible for dispatching');
28 1
    }
29
30
    protected function execute(InputInterface $input, OutputInterface $output): int
31
    {
32
        $this->dispatcher->dispatch();
33
34
        return 0;
35
    }
36
}
37