Completed
Push — master ( fdb7de...e17409 )
by Sergey
03:32
created

BasicConsumeOk   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 39
loc 39
rs 10

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/*
3
 * This file is automatically generated.
4
 */
5
6
namespace ButterAMQP\Framing\Method;
7
8
use ButterAMQP\Framing\Frame;
9
use ButterAMQP\Value;
10
11
/**
12
 * Confirm a new consumer.
13
 *
14
 * @codeCoverageIgnore
15
 */
16
class BasicConsumeOk extends Frame
17
{
18
    /**
19
     * @var string
20
     */
21
    private $consumerTag;
22
23
    /**
24
     * @param int    $channel
25
     * @param string $consumerTag
26
     */
27
    public function __construct($channel, $consumerTag)
28
    {
29
        $this->consumerTag = $consumerTag;
30
31
        parent::__construct($channel);
32
    }
33
34
    /**
35
     * ConsumerTag.
36
     *
37
     * @return string
38
     */
39
    public function getConsumerTag()
40
    {
41
        return $this->consumerTag;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function encode()
48
    {
49
        $data = "\x00\x3C\x00\x15".
50
            Value\ShortStringValue::encode($this->consumerTag);
51
52
        return "\x01".pack('nN', $this->channel, strlen($data)).$data."\xCE";
53
    }
54
}
55