OutgoingPhysicalMessageMutationContext::getBody()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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