Passed
Pull Request — master (#3)
by Timothy
11:06 queued 05:35
created

DataUpdate   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 84
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 84
loc 84
rs 10
wmc 7

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
# Generated by the protocol buffer compiler.  DO NOT EDIT!
3
# source: gossip/message.proto
4
5
namespace Hyperledger\Fabric\Protos\Gossip;
6
7
use Google\Protobuf\Internal\GPBType;
8
use Google\Protobuf\Internal\RepeatedField;
9
use Google\Protobuf\Internal\GPBUtil;
10
11
/**
12
 * DataUpdate is the final message in the pull phase
13
 * sent from the receiver to the initiator
14
 *
15
 * Generated from protobuf message <code>gossip.DataUpdate</code>
16
 */
17
class DataUpdate extends \Google\Protobuf\Internal\Message
18
{
19
    /**
20
     * Generated from protobuf field <code>uint64 nonce = 1;</code>
21
     */
22
    private $nonce = 0;
23
    /**
24
     * Generated from protobuf field <code>repeated .gossip.Envelope data = 2;</code>
25
     */
26
    private $data;
27
    /**
28
     * Generated from protobuf field <code>.gossip.PullMsgType msg_type = 3;</code>
29
     */
30
    private $msg_type = 0;
31
32
    public function __construct() {
33
        \GPBMetadata\Gossip\Message::initOnce();
34
        parent::__construct();
35
    }
36
37
    /**
38
     * Generated from protobuf field <code>uint64 nonce = 1;</code>
39
     * @return int|string
40
     */
41
    public function getNonce()
42
    {
43
        return $this->nonce;
44
    }
45
46
    /**
47
     * Generated from protobuf field <code>uint64 nonce = 1;</code>
48
     * @param int|string $var
49
     * @return $this
50
     */
51
    public function setNonce($var)
52
    {
53
        GPBUtil::checkUint64($var);
54
        $this->nonce = $var;
55
56
        return $this;
57
    }
58
59
    /**
60
     * Generated from protobuf field <code>repeated .gossip.Envelope data = 2;</code>
61
     * @return \Google\Protobuf\Internal\RepeatedField
62
     */
63
    public function getData()
64
    {
65
        return $this->data;
66
    }
67
68
    /**
69
     * Generated from protobuf field <code>repeated .gossip.Envelope data = 2;</code>
70
     * @param \Hyperledger\Fabric\Protos\Gossip\Envelope[]|\Google\Protobuf\Internal\RepeatedField $var
71
     * @return $this
72
     */
73
    public function setData($var)
74
    {
75
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Hyperledger\Fabric\Protos\Gossip\Envelope::class);
76
        $this->data = $arr;
77
78
        return $this;
79
    }
80
81
    /**
82
     * Generated from protobuf field <code>.gossip.PullMsgType msg_type = 3;</code>
83
     * @return int
84
     */
85
    public function getMsgType()
86
    {
87
        return $this->msg_type;
88
    }
89
90
    /**
91
     * Generated from protobuf field <code>.gossip.PullMsgType msg_type = 3;</code>
92
     * @param int $var
93
     * @return $this
94
     */
95
    public function setMsgType($var)
96
    {
97
        GPBUtil::checkEnum($var, \Hyperledger\Fabric\Protos\Gossip\PullMsgType::class);
98
        $this->msg_type = $var;
99
100
        return $this;
101
    }
102
103
}
104
105