Completed
Push — master ( b56704...b07206 )
by David
14s queued 10s
created

ReplyCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace TheAentMachine;
5
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/**
11
 * A special command that is used to receive replies from a dispatch
12
 */
13
class ReplyCommand extends EventCommand
14
{
15
16
    private $replyAggregator;
17
18
    public function __construct(ReplyAggregator $replyAggregator)
19
    {
20
        parent::__construct();
21
        $this->replyAggregator = $replyAggregator;
22
    }
23
24
    protected function configure()
25
    {
26
        parent::configure();
27
        $this->setHidden(true);
28
    }
29
30
    protected function getEventName(): string
31
    {
32
        return 'reply';
33
    }
34
35
    protected function executeEvent(?string $payload): ?string
36
    {
37
        $this->replyAggregator->storeReply($payload);
0 ignored issues
show
Bug introduced by
It seems like $payload can also be of type null; however, parameter $payload of TheAentMachine\ReplyAggregator::storeReply() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

37
        $this->replyAggregator->storeReply(/** @scrutinizer ignore-type */ $payload);
Loading history...
38
        return null;
39
    }
40
}
41