Completed
Pull Request — master (#591)
by thomas
22:54 queued 09:12
created

Payment::setMemo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace BitWasp\Bitcoin\PaymentProtocol\Protobufs;
4
5
use DrSlump\Protobuf\Message;
6
7
class Payment extends Message
8
{
9
10
    /**  @var string */
11
    public $merchant_data;
12
13
    /**  @var string[] */
14
    public $transactions = array();
15
16
    /**  @var \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output[] */
17
    public $refund_to = array();
18
19
    /**  @var string */
20
    public $memo;
21
22
23
    /** @var \Closure[] */
24
    protected static $__extensions = array();
25
26
    public static function descriptor()
27
    {
28
        $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'payments.Payment');
29
30
        // OPTIONAL BYTES merchant_data = 1
31
        $f = new \DrSlump\Protobuf\Field();
32
        $f->number = 1;
33
        $f->name = 'merchant_data';
34
        $f->type = \DrSlump\Protobuf::TYPE_BYTES;
35
        $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
36
        $descriptor->addField($f);
37
38
        // REPEATED BYTES transactions = 2
39
        $f = new \DrSlump\Protobuf\Field();
40
        $f->number = 2;
41
        $f->name = 'transactions';
42
        $f->type = \DrSlump\Protobuf::TYPE_BYTES;
43
        $f->rule = \DrSlump\Protobuf::RULE_REPEATED;
44
        $descriptor->addField($f);
45
46
        // REPEATED MESSAGE refund_to = 3
47
        $f = new \DrSlump\Protobuf\Field();
48
        $f->number = 3;
49
        $f->name = 'refund_to';
50
        $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
51
        $f->rule = \DrSlump\Protobuf::RULE_REPEATED;
52
        $f->reference = '\BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output';
53
        $descriptor->addField($f);
54
55
        // OPTIONAL STRING memo = 4
56
        $f = new \DrSlump\Protobuf\Field();
57
        $f->number = 4;
58
        $f->name = 'memo';
59
        $f->type = \DrSlump\Protobuf::TYPE_STRING;
60
        $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
61
        $descriptor->addField($f);
62
63
        foreach (self::$__extensions as $cb) {
64
            $descriptor->addField($cb(), true);
65
        }
66
67
        return $descriptor;
68
    }
69
70
    /**
71
     * Check if <merchant_data> has a value
72
     *
73
     * @return boolean
74
     */
75
    public function hasMerchantData()
76
    {
77
        return $this->_has(1);
78
    }
79
80
    /**
81
     * Clear <merchant_data> value
82
     *
83
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
84
     */
85
    public function clearMerchantData()
86
    {
87
        return $this->_clear(1);
88
    }
89
90
    /**
91
     * Get <merchant_data> value
92
     *
93
     * @return string
94
     */
95 1
    public function getMerchantData()
96
    {
97 1
        return $this->_get(1);
98
    }
99
100
    /**
101
     * Set <merchant_data> value
102
     *
103
     * @param string $value
104
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
105
     */
106 1
    public function setMerchantData($value)
107
    {
108 1
        return $this->_set(1, $value);
109
    }
110
111
    /**
112
     * Check if <transactions> has a value
113
     *
114
     * @return boolean
115
     */
116
    public function hasTransactions()
117
    {
118
        return $this->_has(2);
119
    }
120
121
    /**
122
     * Clear <transactions> value
123
     *
124
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
125
     */
126
    public function clearTransactions()
127
    {
128
        return $this->_clear(2);
129
    }
130
131
    /**
132
     * Get <transactions> value
133
     *
134
     * @param int $idx
135
     * @return string
136
     */
137
    public function getTransactions($idx = null)
138
    {
139
        return $this->_get(2, $idx);
140
    }
141
142
    /**
143
     * Set <transactions> value
144
     *
145
     * @param string $value
146
     * @param int $idx
147
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
148
     */
149 1
    public function setTransactions($value, $idx = null)
150
    {
151 1
        return $this->_set(2, $value, $idx);
152
    }
153
154
    /**
155
     * Get all elements of <transactions>
156
     *
157
     * @return string[]
158
     */
159 7
    public function getTransactionsList()
160
    {
161 7
        return $this->_get(2);
162
    }
163
164
    /**
165
     * Add a new element to <transactions>
166
     *
167
     * @param string $value
168
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
169
     */
170
    public function addTransactions($value)
171
    {
172
        return $this->_add(2, $value);
173
    }
174
175
    /**
176
     * Check if <refund_to> has a value
177
     *
178
     * @return boolean
179
     */
180
    public function hasRefundTo()
181
    {
182
        return $this->_has(3);
183
    }
184
185
    /**
186
     * Clear <refund_to> value
187
     *
188
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
189
     */
190
    public function clearRefundTo()
191
    {
192
        return $this->_clear(3);
193
    }
194
195
    /**
196
     * Get <refund_to> value
197
     *
198
     * @param int $idx
199
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output
200
     */
201
    public function getRefundTo($idx = null)
202
    {
203
        return $this->_get(3, $idx);
204
    }
205
206
    /**
207
     * Set <refund_to> value
208
     *
209
     * @param \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output $value
210
     * @param int $idx
211
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
212
     */
213
    public function setRefundTo(\BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output $value, $idx = null)
214
    {
215
        return $this->_set(3, $value, $idx);
216
    }
217
218
    /**
219
     * Get all elements of <refund_to>
220
     *
221
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output[]
222
     */
223
    public function getRefundToList()
224
    {
225
        return $this->_get(3);
226
    }
227
228
    /**
229
     * Add a new element to <refund_to>
230
     *
231
     * @param \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output $value
232
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
233
     */
234 1
    public function addRefundTo(\BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output $value)
235
    {
236 1
        return $this->_add(3, $value);
237
    }
238
239
    /**
240
     * Check if <memo> has a value
241
     *
242
     * @return boolean
243
     */
244
    public function hasMemo()
245
    {
246
        return $this->_has(4);
247
    }
248
249
    /**
250
     * Clear <memo> value
251
     *
252
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
253
     */
254
    public function clearMemo()
255
    {
256
        return $this->_clear(4);
257
    }
258
259
    /**
260
     * Get <memo> value
261
     *
262
     * @return string
263
     */
264
    public function getMemo()
265
    {
266
        return $this->_get(4);
267
    }
268
269
    /**
270
     * Set <memo> value
271
     *
272
     * @param string $value
273
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Payment
274
     */
275
    public function setMemo($value)
276
    {
277
        return $this->_set(4, $value);
278
    }
279
}
280