Completed
Push — master ( b2abd4...891c12 )
by thomas
22:03
created

PaymentDetails::clearPaymentUrl()   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 0
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;
6
use DrSlump\Protobuf\Descriptor;
7
use DrSlump\Protobuf\Field;
8
use \DrSlump\Protobuf\Message;
9
10
class PaymentDetails extends Message
11
{
12
13
    /**  @var string */
14
    public $network = 'main';
15
16
    /**  @var \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output[] */
17
    public $outputs = array();
18
19
    /**  @var int */
20
    public $time;
21
22
    /**  @var int */
23
    public $expires;
24
25
    /**  @var string */
26
    public $memo;
27
28
    /**  @var string */
29
    public $payment_url;
30
31
    /**  @var string */
32
    public $merchant_data;
33
34
35
    /** @var \Closure[] */
36
    protected static $__extensions = array();
37
38
    public static function descriptor()
39
    {
40
        $descriptor = new Descriptor(__CLASS__, 'payments.PaymentDetails');
41
42
        // OPTIONAL STRING network = 1
43
        $f = new Field();
44
        $f->number = 1;
45
        $f->name = 'network';
46
        $f->type = Protobuf::TYPE_STRING;
47
        $f->rule = Protobuf::RULE_OPTIONAL;
48
        $f->default = 'main';
49
        $descriptor->addField($f);
50
51
        // REPEATED MESSAGE outputs = 2
52
        $f = new Field();
53
        $f->number = 2;
54
        $f->name = 'outputs';
55
        $f->type = Protobuf::TYPE_MESSAGE;
56
        $f->rule = Protobuf::RULE_REPEATED;
57
        $f->reference = '\BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output';
58
        $descriptor->addField($f);
59
60
        // REQUIRED UINT64 time = 3
61
        $f = new Field();
62
        $f->number = 3;
63
        $f->name = 'time';
64
        $f->type = Protobuf::TYPE_UINT64;
65
        $f->rule = Protobuf::RULE_REQUIRED;
66
        $descriptor->addField($f);
67
68
        // OPTIONAL UINT64 expires = 4
69
        $f = new Field();
70
        $f->number = 4;
71
        $f->name = 'expires';
72
        $f->type = Protobuf::TYPE_UINT64;
73
        $f->rule = Protobuf::RULE_OPTIONAL;
74
        $descriptor->addField($f);
75
76
        // OPTIONAL STRING memo = 5
77
        $f = new Field();
78
        $f->number = 5;
79
        $f->name = 'memo';
80
        $f->type = Protobuf::TYPE_STRING;
81
        $f->rule = Protobuf::RULE_OPTIONAL;
82
        $descriptor->addField($f);
83
84
        // OPTIONAL STRING payment_url = 6
85
        $f = new Field();
86
        $f->number = 6;
87
        $f->name = 'payment_url';
88
        $f->type = Protobuf::TYPE_STRING;
89
        $f->rule = Protobuf::RULE_OPTIONAL;
90
        $descriptor->addField($f);
91
92
        // OPTIONAL BYTES merchant_data = 7
93
        $f = new Field();
94
        $f->number = 7;
95
        $f->name = 'merchant_data';
96
        $f->type = Protobuf::TYPE_BYTES;
97
        $f->rule = Protobuf::RULE_OPTIONAL;
98
        $descriptor->addField($f);
99
100
        foreach (self::$__extensions as $cb) {
101
            $descriptor->addField($cb(), true);
102
        }
103
104
        return $descriptor;
105
    }
106
107
    /**
108
     * Check if <network> has a value
109
     *
110
     * @return boolean
111
     */
112
    public function hasNetwork()
113
    {
114
        return $this->_has(1);
115
    }
116
117
    /**
118
     * Clear <network> value
119
     *
120
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
121
     */
122
    public function clearNetwork()
123
    {
124
        return $this->_clear(1);
125
    }
126
127
    /**
128
     * Get <network> value
129
     *
130
     * @return string
131
     */
132 4
    public function getNetwork()
133
    {
134 4
        return $this->_get(1);
135
    }
136
137
    /**
138
     * Set <network> value
139
     *
140
     * @param string $value
141
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
142
     */
143 8
    public function setNetwork($value)
144
    {
145 8
        return $this->_set(1, $value);
146
    }
147
148
    /**
149
     * Check if <outputs> has a value
150
     *
151
     * @return boolean
152
     */
153
    public function hasOutputs()
154
    {
155
        return $this->_has(2);
156
    }
157
158
    /**
159
     * Clear <outputs> value
160
     *
161
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
162
     */
163
    public function clearOutputs()
164
    {
165
        return $this->_clear(2);
166
    }
167
168
    /**
169
     * Get <outputs> value
170
     *
171
     * @param int $idx
172
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output
173
     */
174 8
    public function getOutputs($idx = null)
175
    {
176 8
        return $this->_get(2, $idx);
177
    }
178
179
    /**
180
     * Set <outputs> value
181
     *
182
     * @param \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output $value
183
     * @param int $idx
184
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
185
     */
186 12
    public function setOutputs(\BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output $value, $idx = null)
187
    {
188 12
        return $this->_set(2, $value, $idx);
189
    }
190
191
    /**
192
     * Get all elements of <outputs>
193
     *
194
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output[]
195
     */
196 28
    public function getOutputsList()
197
    {
198 28
        return $this->_get(2);
199
    }
200
201
    /**
202
     * Add a new element to <outputs>
203
     *
204
     * @param \BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output $value
205
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
206
     */
207
    public function addOutputs(\BitWasp\Bitcoin\PaymentProtocol\Protobufs\Output $value)
208
    {
209
        return $this->_add(2, $value);
210
    }
211
212
    /**
213
     * Check if <time> has a value
214
     *
215
     * @return boolean
216
     */
217
    public function hasTime()
218
    {
219
        return $this->_has(3);
220
    }
221
222
    /**
223
     * Clear <time> value
224
     *
225
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
226
     */
227
    public function clearTime()
228
    {
229
        return $this->_clear(3);
230
    }
231
232
    /**
233
     * Get <time> value
234
     *
235
     * @return int
236
     */
237 4
    public function getTime()
238
    {
239 4
        return $this->_get(3);
240
    }
241
242
    /**
243
     * Set <time> value
244
     *
245
     * @param int $value
246
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
247
     */
248 28
    public function setTime($value)
249
    {
250 28
        return $this->_set(3, $value);
251
    }
252
253
    /**
254
     * Check if <expires> has a value
255
     *
256
     * @return boolean
257
     */
258
    public function hasExpires()
259
    {
260
        return $this->_has(4);
261
    }
262
263
    /**
264
     * Clear <expires> value
265
     *
266
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
267
     */
268
    public function clearExpires()
269
    {
270
        return $this->_clear(4);
271
    }
272
273
    /**
274
     * Get <expires> value
275
     *
276
     * @return int
277
     */
278 4
    public function getExpires()
279
    {
280 4
        return $this->_get(4);
281
    }
282
283
    /**
284
     * Set <expires> value
285
     *
286
     * @param int $value
287
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
288
     */
289 8
    public function setExpires($value)
290
    {
291 8
        return $this->_set(4, $value);
292
    }
293
294
    /**
295
     * Check if <memo> has a value
296
     *
297
     * @return boolean
298
     */
299
    public function hasMemo()
300
    {
301
        return $this->_has(5);
302
    }
303
304
    /**
305
     * Clear <memo> value
306
     *
307
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
308
     */
309
    public function clearMemo()
310
    {
311
        return $this->_clear(5);
312
    }
313
314
    /**
315
     * Get <memo> value
316
     *
317
     * @return string
318
     */
319 4
    public function getMemo()
320
    {
321 4
        return $this->_get(5);
322
    }
323
324
    /**
325
     * Set <memo> value
326
     *
327
     * @param string $value
328
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
329
     */
330 8
    public function setMemo($value)
331
    {
332 8
        return $this->_set(5, $value);
333
    }
334
335
    /**
336
     * Check if <payment_url> has a value
337
     *
338
     * @return boolean
339
     */
340
    public function hasPaymentUrl()
341
    {
342
        return $this->_has(6);
343
    }
344
345
    /**
346
     * Clear <payment_url> value
347
     *
348
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
349
     */
350
    public function clearPaymentUrl()
351
    {
352
        return $this->_clear(6);
353
    }
354
355
    /**
356
     * Get <payment_url> value
357
     *
358
     * @return string
359
     */
360 4
    public function getPaymentUrl()
361
    {
362 4
        return $this->_get(6);
363
    }
364
365
    /**
366
     * Set <payment_url> value
367
     *
368
     * @param string $value
369
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
370
     */
371 8
    public function setPaymentUrl($value)
372
    {
373 8
        return $this->_set(6, $value);
374
    }
375
376
    /**
377
     * Check if <merchant_data> has a value
378
     *
379
     * @return boolean
380
     */
381
    public function hasMerchantData()
382
    {
383
        return $this->_has(7);
384
    }
385
386
    /**
387
     * Clear <merchant_data> value
388
     *
389
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
390
     */
391
    public function clearMerchantData()
392
    {
393
        return $this->_clear(7);
394
    }
395
396
    /**
397
     * Get <merchant_data> value
398
     *
399
     * @return string
400
     */
401 8
    public function getMerchantData()
402
    {
403 8
        return $this->_get(7);
404
    }
405
406
    /**
407
     * Set <merchant_data> value
408
     *
409
     * @param string $value
410
     * @return \BitWasp\Bitcoin\PaymentProtocol\Protobufs\PaymentDetails
411
     */
412 8
    public function setMerchantData($value)
413
    {
414 8
        return $this->_set(7, $value);
415
    }
416
}
417