Code Duplication    Length = 23-23 lines in 2 locations

PHPDaemon/Clients/AMQP/Driver/Protocol/v091/Parser/MethodFrameParserTrait.php 2 locations

@@ 105-127 (lines=23) @@
102
103
                // method "connection.close"
104
            }
105
            if ($method === 50) {
106
                $frame = new Connection\ConnectionCloseFrame();
107
108
                // consume "replyCode" (short)
109
                list(, $frame->replyCode) = \unpack('n', $this->buffer);
110
                $this->buffer = mb_orig_substr($this->buffer, 2);
111
112
                // consume "reply-text" (shortstr)
113
                $length = \ord($this->buffer);
114
                $frame->replyText = mb_orig_substr($this->buffer, 1, $length);
115
                $this->buffer = mb_orig_substr($this->buffer, 1 + $length);
116
117
                // consume (a) "class-id" (short)
118
                // consume (b) "method-id" (short)
119
                $fields = \unpack('na/nb', $this->buffer);
120
                $this->buffer = mb_orig_substr($this->buffer, 4);
121
                $frame->classId = $fields['a'];
122
                $frame->methodId = $fields['b'];
123
124
                return $frame;
125
126
                // method "connection.close-ok"
127
            }
128
            if ($method === 51) {
129
                return new Connection\ConnectionCloseOkFrame();
130
@@ 191-213 (lines=23) @@
188
189
                // method "channel.close"
190
            }
191
            if ($method === 40) {
192
                $frame = new Channel\ChannelCloseFrame();
193
194
                // consume "replyCode" (short)
195
                list(, $frame->replyCode) = \unpack('n', $this->buffer);
196
                $this->buffer = mb_orig_substr($this->buffer, 2);
197
198
                // consume "reply-text" (shortstr)
199
                $length = \ord($this->buffer);
200
                $frame->replyText = mb_orig_substr($this->buffer, 1, $length);
201
                $this->buffer = mb_orig_substr($this->buffer, 1 + $length);
202
203
                // consume (a) "class-id" (short)
204
                // consume (b) "method-id" (short)
205
                $fields = \unpack('na/nb', $this->buffer);
206
                $this->buffer = mb_orig_substr($this->buffer, 4);
207
                $frame->classId = $fields['a'];
208
                $frame->methodId = $fields['b'];
209
210
                return $frame;
211
212
                // method "channel.close-ok"
213
            }
214
            if ($method === 41) {
215
                return new Channel\ChannelCloseOkFrame();
216
            }