Completed
Pull Request — master (#1)
by Sergey
04:51
created

BasicGetOk::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 6
1
<?php
2
/*
3
 * This file is automatically generated.
4
 */
5
6
namespace ButterAMQP\AMQP091\Framing\Method;
7
8
use ButterAMQP\AMQP091\Framing\Frame;
9
use ButterAMQP\Value;
10
11
/**
12
 * Provide client with a message.
13
 *
14
 * @codeCoverageIgnore
15
 */
16
class BasicGetOk extends Frame
17
{
18
    /**
19
     * @var int
20
     */
21
    private $deliveryTag;
22
23
    /**
24
     * @var bool
25
     */
26
    private $redelivered;
27
28
    /**
29
     * @var string
30
     */
31
    private $exchange;
32
33
    /**
34
     * @var string
35
     */
36
    private $routingKey;
37
38
    /**
39
     * @var int
40
     */
41
    private $messageCount;
42
43
    /**
44
     * @param int    $channel
45
     * @param int    $deliveryTag
46
     * @param bool   $redelivered
47
     * @param string $exchange
48
     * @param string $routingKey
49
     * @param int    $messageCount
50
     */
51
    public function __construct($channel, $deliveryTag, $redelivered, $exchange, $routingKey, $messageCount)
52
    {
53
        $this->deliveryTag = $deliveryTag;
54
        $this->redelivered = $redelivered;
55
        $this->exchange = $exchange;
56
        $this->routingKey = $routingKey;
57
        $this->messageCount = $messageCount;
58
59
        parent::__construct($channel);
60
    }
61
62
    /**
63
     * DeliveryTag.
64
     *
65
     * @return int
66
     */
67
    public function getDeliveryTag()
68
    {
69
        return $this->deliveryTag;
70
    }
71
72
    /**
73
     * Redelivered.
74
     *
75
     * @return bool
76
     */
77
    public function isRedelivered()
78
    {
79
        return $this->redelivered;
80
    }
81
82
    /**
83
     * Exchange.
84
     *
85
     * @return string
86
     */
87
    public function getExchange()
88
    {
89
        return $this->exchange;
90
    }
91
92
    /**
93
     * Message routing key.
94
     *
95
     * @return string
96
     */
97
    public function getRoutingKey()
98
    {
99
        return $this->routingKey;
100
    }
101
102
    /**
103
     * MessageCount.
104
     *
105
     * @return int
106
     */
107
    public function getMessageCount()
108
    {
109
        return $this->messageCount;
110
    }
111
112
    /**
113
     * @return string
114
     */
115
    public function encode()
116
    {
117
        $data = "\x00\x3C\x00\x47".
118
            Value\LongLongValue::encode($this->deliveryTag).
119
            Value\BooleanValue::encode($this->redelivered).
120
            Value\ShortStringValue::encode($this->exchange).
121
            Value\ShortStringValue::encode($this->routingKey).
122
            Value\LongValue::encode($this->messageCount);
123
124
        return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE";
125
    }
126
}
127