Code Duplication    Length = 59-59 lines in 2 locations

src/MessageMutation/Pipeline/Incoming/IncomingPhysicalMessageMutationContext.php 1 location

@@ 7-65 (lines=59) @@
4
5
use PSB\Core\Util\Guard;
6
7
class IncomingPhysicalMessageMutationContext
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
    public function __construct($body, array $headers)
24
    {
25
        Guard::againstNull('body', $body);
26
27
        $this->body = $body;
28
        $this->headers = $headers;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getBody()
35
    {
36
        return $this->body;
37
    }
38
39
    /**
40
     * @return array
41
     */
42
    public function getHeaders()
43
    {
44
        return $this->headers;
45
    }
46
47
    /**
48
     * @param string $newBody
49
     */
50
    public function replaceBody($newBody)
51
    {
52
        Guard::againstNull('body', $newBody);
53
54
        $this->body = $newBody;
55
    }
56
57
    /**
58
     * @param string $name
59
     * @param string $value
60
     */
61
    public function setHeader($name, $value)
62
    {
63
        $this->headers[$name] = $value;
64
    }
65
}

src/MessageMutation/Pipeline/Outgoing/OutgoingPhysicalMessageMutationContext.php 1 location

@@ 7-65 (lines=59) @@
4
5
use PSB\Core\Util\Guard;
6
7
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
    public function __construct($body, array $headers)
24
    {
25
        Guard::againstNull('body', $body);
26
27
        $this->body = $body;
28
        $this->headers = $headers;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getBody()
35
    {
36
        return $this->body;
37
    }
38
39
    /**
40
     * @param string $newBody
41
     */
42
    public function replaceBody($newBody)
43
    {
44
        Guard::againstNull('body', $newBody);
45
46
        $this->body = $newBody;
47
    }
48
49
    /**
50
     * @return array
51
     */
52
    public function getHeaders()
53
    {
54
        return $this->headers;
55
    }
56
57
    /**
58
     * @param string $name
59
     * @param string $value
60
     */
61
    public function setHeader($name, $value)
62
    {
63
        $this->headers[$name] = $value;
64
    }
65
}
66