OutgoingContext::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
namespace PSB\Core\Pipeline\Outgoing;
3
4
5
use PSB\Core\Pipeline\PipelineStageContext;
6
7
abstract class OutgoingContext extends PipelineStageContext
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $messageId;
13
14
    /**
15
     * @var array
16
     */
17
    protected $headers;
18
19
    /**
20
     * OutgoingContext constructor.
21
     *
22
     * @param string               $messageId
23
     * @param array                $headers
24
     * @param PipelineStageContext $parentContext
25
     */
26 52
    public function __construct($messageId, array $headers, PipelineStageContext $parentContext)
27
    {
28 52
        parent::__construct($parentContext);
29
30 52
        $this->messageId = $messageId;
31 52
        $this->headers = $headers;
32 52
    }
33
34
    /**
35
     * @return string
36
     */
37 6
    public function getMessageId()
38
    {
39 6
        return $this->messageId;
40
    }
41
42
    /**
43
     * @return array
44
     */
45 9
    public function getHeaders()
46
    {
47 9
        return $this->headers;
48
    }
49
50
    /**
51
     * @param string $name
52
     * @param string $value
53
     */
54 1
    public function setHeader($name, $value)
55
    {
56 1
        $this->headers[$name] = $value;
57 1
    }
58
59
    /**
60
     * @param array $headers
61
     */
62 1
    public function replaceHeaders(array $headers)
63
    {
64 1
        $this->headers = $headers;
65 1
    }
66
}
67