Output::clearAmount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Bip70\Protobuf\Proto;
6
7
use DrSlump\Protobuf;
8
use DrSlump\Protobuf\Descriptor;
9
use DrSlump\Protobuf\Field;
10
use DrSlump\Protobuf\Message;
11
12
class Output extends Message
13
{
14
15
    /**  @var int */
16
    public $amount = 0;
17
18
    /**  @var string */
19
    public $script;
20
21
22
    /** @var \Closure[] */
23
    protected static $__extensions = array();
24
25 1
    public static function descriptor()
26
    {
27 1
        $descriptor = new Descriptor(__CLASS__, 'payments.Output');
28
29
        // OPTIONAL UINT64 amount = 1
30 1
        $f = new Field();
31 1
        $f->number = 1;
32 1
        $f->name = 'amount';
33 1
        $f->type = Protobuf::TYPE_UINT64;
34 1
        $f->rule = Protobuf::RULE_OPTIONAL;
35 1
        $f->default = 0;
36 1
        $descriptor->addField($f);
37
38
        // REQUIRED BYTES script = 2
39 1
        $f = new Field();
40 1
        $f->number = 2;
41 1
        $f->name = 'script';
42 1
        $f->type = Protobuf::TYPE_BYTES;
43 1
        $f->rule = Protobuf::RULE_REQUIRED;
44 1
        $descriptor->addField($f);
45
46 1
        foreach (self::$__extensions as $cb) {
47
            $descriptor->addField($cb(), true);
48
        }
49
50 1
        return $descriptor;
51
    }
52
53
    /**
54
     * Check if <amount> has a value
55
     *
56
     * @return boolean
57
     */
58 1
    public function hasAmount()
59
    {
60 1
        return $this->_has(1);
61
    }
62
63
    /**
64
     * Clear <amount> value
65
     *
66
     * @return \Bip70\Protobuf\Proto\Output
67
     */
68 1
    public function clearAmount()
69
    {
70 1
        return $this->_clear(1);
71
    }
72
73
    /**
74
     * Get <amount> value
75
     *
76
     * @return int
77
     */
78 4
    public function getAmount()
79
    {
80 4
        return $this->_get(1);
81
    }
82
83
    /**
84
     * Set <amount> value
85
     *
86
     * @param int $value
87
     * @return \Bip70\Protobuf\Proto\Output
88
     */
89 4
    public function setAmount($value)
90
    {
91 4
        return $this->_set(1, $value);
92
    }
93
94
    /**
95
     * Check if <script> has a value
96
     *
97
     * @return boolean
98
     */
99 1
    public function hasScript()
100
    {
101 1
        return $this->_has(2);
102
    }
103
104
    /**
105
     * Clear <script> value
106
     *
107
     * @return \Bip70\Protobuf\Proto\Output
108
     */
109 1
    public function clearScript()
110
    {
111 1
        return $this->_clear(2);
112
    }
113
114
    /**
115
     * Get <script> value
116
     *
117
     * @return string
118
     */
119 4
    public function getScript()
120
    {
121 4
        return $this->_get(2);
122
    }
123
124
    /**
125
     * Set <script> value
126
     *
127
     * @param string $value
128
     * @return \Bip70\Protobuf\Proto\Output
129
     */
130 4
    public function setScript($value)
131
    {
132 4
        return $this->_set(2, $value);
133
    }
134
}
135