Completed
Push — master ( ae5fca...d9758b )
by Julien
13s
created

ReplyCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A executeEvent() 0 4 1
A getEventName() 0 3 1
A configure() 0 4 1
1
<?php
2
3
4
namespace TheAentMachine\Command;
5
6
use TheAentMachine\ReplyAggregator;
7
8
/**
9
 * A special command that is used to receive replies from a dispatch
10
 */
11
class ReplyCommand extends EventCommand
12
{
13
    private $replyAggregator;
14
15
    public function __construct(ReplyAggregator $replyAggregator)
16
    {
17
        parent::__construct();
18
        $this->replyAggregator = $replyAggregator;
19
    }
20
21
    protected function configure()
22
    {
23
        parent::configure();
24
        $this->setHidden(true);
25
    }
26
27
    protected function getEventName(): string
28
    {
29
        return 'reply';
30
    }
31
32
    protected function executeEvent(?string $payload): ?string
33
    {
34
        $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

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