Returned::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 6
crap 1
1
<?php
2
3
namespace ButterAMQP;
4
5
/**
6
 * Message returned back to the publisher.
7
 */
8
class Returned extends Message
9
{
10
    /**
11
     * @var string
12
     */
13
    private $exchange;
14
15
    /**
16
     * @var string
17
     */
18
    private $routingKey;
19
20
    /**
21
     * @var int
22
     */
23
    private $replyCode;
24
25
    /**
26
     * @var string
27
     */
28
    private $replyText;
29
30
    /**
31
     * @param int    $replyCode
32
     * @param string $replyText
33
     * @param string $exchange
34
     * @param string $routingKey
35
     * @param string $body
36
     * @param array  $properties
37
     */
38 2
    public function __construct(
39
        $replyCode,
40
        $replyText,
41
        $exchange,
42
        $routingKey,
43
        $body,
44
        array $properties
45
    ) {
46 2
        $this->replyCode = $replyCode;
47 2
        $this->replyText = $replyText;
48 2
        $this->exchange = $exchange;
49 2
        $this->routingKey = $routingKey;
50
51 2
        parent::__construct($body, $properties);
52 2
    }
53
54
    /**
55
     * Exchange where message was sent initially.
56
     *
57
     * @return string
58
     */
59
    public function getExchange()
60
    {
61
        return $this->exchange;
62
    }
63
64
    /**
65
     * Routing key.
66
     *
67
     * @return string
68
     */
69
    public function getRoutingKey()
70
    {
71
        return $this->routingKey;
72
    }
73
74
    /**
75
     * Define how to print object when dumping.
76
     *
77
     * @return array
78
     */
79
    public function __debugInfo()
80
    {
81
        return array_merge(parent::__debugInfo(), [
82
            'reply_code' => $this->replyCode,
83
            'reply_text' => $this->replyText,
84
            'exchange' => $this->exchange,
85
            'routing_key' => $this->routingKey,
86
        ]);
87
    }
88
}
89