AttachReplyToAddressPipelineStep::invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
namespace PSB\Core\Routing\Pipeline;
3
4
5
use PSB\Core\HeaderTypeEnum;
6
use PSB\Core\Pipeline\Outgoing\StageContext\OutgoingLogicalMessageContext;
7
use PSB\Core\Pipeline\PipelineStepInterface;
8
9
class AttachReplyToAddressPipelineStep implements PipelineStepInterface
10
{
11
    /**
12
     * @var string
13
     */
14
    private $replyToAddress;
15
16
    /**
17
     * @param string $replyToAddress
18
     */
19 4
    public function __construct($replyToAddress)
20
    {
21 4
        $this->replyToAddress = $replyToAddress;
22 4
    }
23
24
    /**
25
     * @param OutgoingLogicalMessageContext $context
26
     * @param callable                      $next
27
     */
28 2
    public function invoke($context, callable $next)
29
    {
30 2
        $context->setHeader(HeaderTypeEnum::REPLY_TO_ADDRESS, $this->replyToAddress);
31
32 2
        $next();
33 2
    }
34
35
    /**
36
     * @return string
37
     */
38 1
    public static function getStageContextClass()
39
    {
40 1
        return OutgoingLogicalMessageContext::class;
41
    }
42
}
43