Code Duplication    Length = 129-129 lines in 3 locations

src/Framing/Method/ExchangeBind.php 1 location

@@ 16-144 (lines=129) @@
13
 *
14
 * @codeCoverageIgnore
15
 */
16
class ExchangeBind extends Frame
17
{
18
    /**
19
     * @var int
20
     */
21
    private $reserved1;
22
23
    /**
24
     * @var string
25
     */
26
    private $destination;
27
28
    /**
29
     * @var string
30
     */
31
    private $source;
32
33
    /**
34
     * @var string
35
     */
36
    private $routingKey;
37
38
    /**
39
     * @var bool
40
     */
41
    private $noWait;
42
43
    /**
44
     * @var array
45
     */
46
    private $arguments = [];
47
48
    /**
49
     * @param int    $channel
50
     * @param int    $reserved1
51
     * @param string $destination
52
     * @param string $source
53
     * @param string $routingKey
54
     * @param bool   $noWait
55
     * @param array  $arguments
56
     */
57
    public function __construct($channel, $reserved1, $destination, $source, $routingKey, $noWait, $arguments)
58
    {
59
        $this->reserved1 = $reserved1;
60
        $this->destination = $destination;
61
        $this->source = $source;
62
        $this->routingKey = $routingKey;
63
        $this->noWait = $noWait;
64
        $this->arguments = $arguments;
65
66
        parent::__construct($channel);
67
    }
68
69
    /**
70
     * Reserved1.
71
     *
72
     * @return int
73
     */
74
    public function getReserved1()
75
    {
76
        return $this->reserved1;
77
    }
78
79
    /**
80
     * Name of the destination exchange to bind to.
81
     *
82
     * @return string
83
     */
84
    public function getDestination()
85
    {
86
        return $this->destination;
87
    }
88
89
    /**
90
     * Name of the source exchange to bind to.
91
     *
92
     * @return string
93
     */
94
    public function getSource()
95
    {
96
        return $this->source;
97
    }
98
99
    /**
100
     * Message routing key.
101
     *
102
     * @return string
103
     */
104
    public function getRoutingKey()
105
    {
106
        return $this->routingKey;
107
    }
108
109
    /**
110
     * NoWait.
111
     *
112
     * @return bool
113
     */
114
    public function isNoWait()
115
    {
116
        return $this->noWait;
117
    }
118
119
    /**
120
     * Arguments for binding.
121
     *
122
     * @return array
123
     */
124
    public function getArguments()
125
    {
126
        return $this->arguments;
127
    }
128
129
    /**
130
     * @return string
131
     */
132
    public function encode()
133
    {
134
        $data = "\x00\x28\x00\x1E".
135
            Value\ShortValue::encode($this->reserved1).
136
            Value\ShortStringValue::encode($this->destination).
137
            Value\ShortStringValue::encode($this->source).
138
            Value\ShortStringValue::encode($this->routingKey).
139
            Value\BooleanValue::encode($this->noWait).
140
            Value\TableValue::encode($this->arguments);
141
142
        return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE";
143
    }
144
}
145

src/Framing/Method/ExchangeUnbind.php 1 location

@@ 16-144 (lines=129) @@
13
 *
14
 * @codeCoverageIgnore
15
 */
16
class ExchangeUnbind extends Frame
17
{
18
    /**
19
     * @var int
20
     */
21
    private $reserved1;
22
23
    /**
24
     * @var string
25
     */
26
    private $destination;
27
28
    /**
29
     * @var string
30
     */
31
    private $source;
32
33
    /**
34
     * @var string
35
     */
36
    private $routingKey;
37
38
    /**
39
     * @var bool
40
     */
41
    private $noWait;
42
43
    /**
44
     * @var array
45
     */
46
    private $arguments = [];
47
48
    /**
49
     * @param int    $channel
50
     * @param int    $reserved1
51
     * @param string $destination
52
     * @param string $source
53
     * @param string $routingKey
54
     * @param bool   $noWait
55
     * @param array  $arguments
56
     */
57
    public function __construct($channel, $reserved1, $destination, $source, $routingKey, $noWait, $arguments)
58
    {
59
        $this->reserved1 = $reserved1;
60
        $this->destination = $destination;
61
        $this->source = $source;
62
        $this->routingKey = $routingKey;
63
        $this->noWait = $noWait;
64
        $this->arguments = $arguments;
65
66
        parent::__construct($channel);
67
    }
68
69
    /**
70
     * Reserved1.
71
     *
72
     * @return int
73
     */
74
    public function getReserved1()
75
    {
76
        return $this->reserved1;
77
    }
78
79
    /**
80
     * Destination.
81
     *
82
     * @return string
83
     */
84
    public function getDestination()
85
    {
86
        return $this->destination;
87
    }
88
89
    /**
90
     * Source.
91
     *
92
     * @return string
93
     */
94
    public function getSource()
95
    {
96
        return $this->source;
97
    }
98
99
    /**
100
     * Routing key of binding.
101
     *
102
     * @return string
103
     */
104
    public function getRoutingKey()
105
    {
106
        return $this->routingKey;
107
    }
108
109
    /**
110
     * NoWait.
111
     *
112
     * @return bool
113
     */
114
    public function isNoWait()
115
    {
116
        return $this->noWait;
117
    }
118
119
    /**
120
     * Arguments of binding.
121
     *
122
     * @return array
123
     */
124
    public function getArguments()
125
    {
126
        return $this->arguments;
127
    }
128
129
    /**
130
     * @return string
131
     */
132
    public function encode()
133
    {
134
        $data = "\x00\x28\x00\x28".
135
            Value\ShortValue::encode($this->reserved1).
136
            Value\ShortStringValue::encode($this->destination).
137
            Value\ShortStringValue::encode($this->source).
138
            Value\ShortStringValue::encode($this->routingKey).
139
            Value\BooleanValue::encode($this->noWait).
140
            Value\TableValue::encode($this->arguments);
141
142
        return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE";
143
    }
144
}
145

src/Framing/Method/QueueBind.php 1 location

@@ 16-144 (lines=129) @@
13
 *
14
 * @codeCoverageIgnore
15
 */
16
class QueueBind extends Frame
17
{
18
    /**
19
     * @var int
20
     */
21
    private $reserved1;
22
23
    /**
24
     * @var string
25
     */
26
    private $queue;
27
28
    /**
29
     * @var string
30
     */
31
    private $exchange;
32
33
    /**
34
     * @var string
35
     */
36
    private $routingKey;
37
38
    /**
39
     * @var bool
40
     */
41
    private $noWait;
42
43
    /**
44
     * @var array
45
     */
46
    private $arguments = [];
47
48
    /**
49
     * @param int    $channel
50
     * @param int    $reserved1
51
     * @param string $queue
52
     * @param string $exchange
53
     * @param string $routingKey
54
     * @param bool   $noWait
55
     * @param array  $arguments
56
     */
57
    public function __construct($channel, $reserved1, $queue, $exchange, $routingKey, $noWait, $arguments)
58
    {
59
        $this->reserved1 = $reserved1;
60
        $this->queue = $queue;
61
        $this->exchange = $exchange;
62
        $this->routingKey = $routingKey;
63
        $this->noWait = $noWait;
64
        $this->arguments = $arguments;
65
66
        parent::__construct($channel);
67
    }
68
69
    /**
70
     * Reserved1.
71
     *
72
     * @return int
73
     */
74
    public function getReserved1()
75
    {
76
        return $this->reserved1;
77
    }
78
79
    /**
80
     * Queue.
81
     *
82
     * @return string
83
     */
84
    public function getQueue()
85
    {
86
        return $this->queue;
87
    }
88
89
    /**
90
     * Name of the exchange to bind to.
91
     *
92
     * @return string
93
     */
94
    public function getExchange()
95
    {
96
        return $this->exchange;
97
    }
98
99
    /**
100
     * Message routing key.
101
     *
102
     * @return string
103
     */
104
    public function getRoutingKey()
105
    {
106
        return $this->routingKey;
107
    }
108
109
    /**
110
     * NoWait.
111
     *
112
     * @return bool
113
     */
114
    public function isNoWait()
115
    {
116
        return $this->noWait;
117
    }
118
119
    /**
120
     * Arguments for binding.
121
     *
122
     * @return array
123
     */
124
    public function getArguments()
125
    {
126
        return $this->arguments;
127
    }
128
129
    /**
130
     * @return string
131
     */
132
    public function encode()
133
    {
134
        $data = "\x00\x32\x00\x14".
135
            Value\ShortValue::encode($this->reserved1).
136
            Value\ShortStringValue::encode($this->queue).
137
            Value\ShortStringValue::encode($this->exchange).
138
            Value\ShortStringValue::encode($this->routingKey).
139
            Value\BooleanValue::encode($this->noWait).
140
            Value\TableValue::encode($this->arguments);
141
142
        return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE";
143
    }
144
}
145