Passed
Pull Request — master (#3)
by Timothy
06:14
created

KafkaMessage   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 81
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 81
loc 81
rs 10
wmc 8

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: orderer/kafka.proto
4
5
namespace Hyperledger\Fabric\Protos\Orderer;
6
7
use Google\Protobuf\Internal\GPBType;
8
use Google\Protobuf\Internal\RepeatedField;
9
use Google\Protobuf\Internal\GPBUtil;
10
11
/**
12
 * KafkaMessage is a wrapper type for the messages
13
 * that the Kafka-based orderer deals with.
14
 *
15
 * Generated from protobuf message <code>orderer.KafkaMessage</code>
16
 */
17
class KafkaMessage extends \Google\Protobuf\Internal\Message
18
{
19
    protected $Type;
20
21
    public function __construct() {
22
        \GPBMetadata\Orderer\Kafka::initOnce();
23
        parent::__construct();
24
    }
25
26
    /**
27
     * Generated from protobuf field <code>.orderer.KafkaMessageRegular regular = 1;</code>
28
     * @return \Hyperledger\Fabric\Protos\Orderer\KafkaMessageRegular
29
     */
30
    public function getRegular()
31
    {
32
        return $this->readOneof(1);
33
    }
34
35
    /**
36
     * Generated from protobuf field <code>.orderer.KafkaMessageRegular regular = 1;</code>
37
     * @param \Hyperledger\Fabric\Protos\Orderer\KafkaMessageRegular $var
38
     * @return $this
39
     */
40
    public function setRegular($var)
41
    {
42
        GPBUtil::checkMessage($var, \Hyperledger\Fabric\Protos\Orderer\KafkaMessageRegular::class);
43
        $this->writeOneof(1, $var);
44
45
        return $this;
46
    }
47
48
    /**
49
     * Generated from protobuf field <code>.orderer.KafkaMessageTimeToCut time_to_cut = 2;</code>
50
     * @return \Hyperledger\Fabric\Protos\Orderer\KafkaMessageTimeToCut
51
     */
52
    public function getTimeToCut()
53
    {
54
        return $this->readOneof(2);
55
    }
56
57
    /**
58
     * Generated from protobuf field <code>.orderer.KafkaMessageTimeToCut time_to_cut = 2;</code>
59
     * @param \Hyperledger\Fabric\Protos\Orderer\KafkaMessageTimeToCut $var
60
     * @return $this
61
     */
62
    public function setTimeToCut($var)
63
    {
64
        GPBUtil::checkMessage($var, \Hyperledger\Fabric\Protos\Orderer\KafkaMessageTimeToCut::class);
65
        $this->writeOneof(2, $var);
66
67
        return $this;
68
    }
69
70
    /**
71
     * Generated from protobuf field <code>.orderer.KafkaMessageConnect connect = 3;</code>
72
     * @return \Hyperledger\Fabric\Protos\Orderer\KafkaMessageConnect
73
     */
74
    public function getConnect()
75
    {
76
        return $this->readOneof(3);
77
    }
78
79
    /**
80
     * Generated from protobuf field <code>.orderer.KafkaMessageConnect connect = 3;</code>
81
     * @param \Hyperledger\Fabric\Protos\Orderer\KafkaMessageConnect $var
82
     * @return $this
83
     */
84
    public function setConnect($var)
85
    {
86
        GPBUtil::checkMessage($var, \Hyperledger\Fabric\Protos\Orderer\KafkaMessageConnect::class);
87
        $this->writeOneof(3, $var);
88
89
        return $this;
90
    }
91
92
    /**
93
     * @return string
94
     */
95
    public function getType()
96
    {
97
        return $this->whichOneof("Type");
98
    }
99
100
}
101
102