Passed
Push — master ( cf3861...beb92a )
by Ludwig
02:01
created

Item::setDiscountRate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of datamolino client.
5
 *
6
 * (c) 2018 cwd.at GmbH <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cwd\Datamolino\Model\Document;
15
16
class Item
17
{
18
    /** @var string|null */
19
    private $code;
20
21
    /** @var string|null */
22
    private $name;
23
24
    /** @var int|null */
25
    private $quantity;
26
27
    /** @var string|null */
28
    private $unit;
29
30
    /** @var string|null */
31
    private $unit_price;
32
33
    /** @var int */
34
    private $tax_rate = 0;
35
36
    /** @var float */
37
    private $subtotal = 0;
38
39
    /** @var float */
40
    private $tax = 0;
41
42
    /** @var float */
43
    private $total = 0;
44
45
    /** @var float */
46
    private $discount_rate = 0.0;
47
48
    /** @var float */
49
    private $discount = 0.0;
50
51
    /**
52
     * @return null|string
53
     */
54
    public function getCode(): ?string
55
    {
56
        return $this->code;
57
    }
58
59
    /**
60
     * @param null|string $code
61
     *
62
     * @return Item
63
     */
64
    public function setCode(?string $code): Item
65
    {
66
        $this->code = $code;
67
68
        return $this;
69
    }
70
71
    /**
72
     * @return null|string
73
     */
74
    public function getName(): ?string
75
    {
76
        return $this->name;
77
    }
78
79
    /**
80
     * @param null|string $name
81
     *
82
     * @return Item
83
     */
84
    public function setName(?string $name): Item
85
    {
86
        $this->name = $name;
87
88
        return $this;
89
    }
90
91
    /**
92
     * @return int|null
93
     */
94
    public function getQuantity(): ?int
95
    {
96
        return $this->quantity;
97
    }
98
99
    /**
100
     * @param int|null $quantity
101
     *
102
     * @return Item
103
     */
104
    public function setQuantity(?int $quantity): Item
105
    {
106
        $this->quantity = $quantity;
107
108
        return $this;
109
    }
110
111
    /**
112
     * @return null|string
113
     */
114
    public function getUnit(): ?string
115
    {
116
        return $this->unit;
117
    }
118
119
    /**
120
     * @param null|string $unit
121
     *
122
     * @return Item
123
     */
124
    public function setUnit(?string $unit): Item
125
    {
126
        $this->unit = $unit;
127
128
        return $this;
129
    }
130
131
    /**
132
     * @return null|string
133
     */
134
    public function getUnitPrice(): ?string
135
    {
136
        return $this->unit_price;
137
    }
138
139
    /**
140
     * @param null|string $unit_price
141
     *
142
     * @return Item
143
     */
144
    public function setUnitPrice(?string $unit_price): Item
145
    {
146
        $this->unit_price = $unit_price;
147
148
        return $this;
149
    }
150
151
    /**
152
     * @return int
153
     */
154
    public function getTaxRate(): int
155
    {
156
        return $this->tax_rate;
157
    }
158
159
    /**
160
     * @param int $tax_rate
161
     *
162
     * @return Item
163
     */
164
    public function setTaxRate(int $tax_rate): Item
165
    {
166
        $this->tax_rate = $tax_rate;
167
168
        return $this;
169
    }
170
171
    /**
172
     * @return float
173
     */
174
    public function getSubtotal(): float
175
    {
176
        return $this->subtotal;
177
    }
178
179
    /**
180
     * @param float $subtotal
181
     *
182
     * @return Item
183
     */
184
    public function setSubtotal(float $subtotal): Item
185
    {
186
        $this->subtotal = $subtotal;
187
188
        return $this;
189
    }
190
191
    /**
192
     * @return float
193
     */
194
    public function getTax(): float
195
    {
196
        return $this->tax;
197
    }
198
199
    /**
200
     * @param float $tax
201
     *
202
     * @return Item
203
     */
204
    public function setTax(float $tax): Item
205
    {
206
        $this->tax = $tax;
207
208
        return $this;
209
    }
210
211
    /**
212
     * @return float
213
     */
214
    public function getTotal(): float
215
    {
216
        return $this->total;
217
    }
218
219
    /**
220
     * @param float $total
221
     *
222
     * @return Item
223
     */
224
    public function setTotal(float $total): Item
225
    {
226
        $this->total = $total;
227
228
        return $this;
229
    }
230
231
    /**
232
     * @return float
233
     */
234
    public function getDiscountRate(): float
235
    {
236
        return $this->discount_rate;
237
    }
238
239
    /**
240
     * @param float $discount_rate
241
     *
242
     * @return Item
243
     */
244
    public function setDiscountRate(float $discount_rate): Item
245
    {
246
        $this->discount_rate = $discount_rate;
247
248
        return $this;
249
    }
250
251
    /**
252
     * @return float
253
     */
254
    public function getDiscount(): float
255
    {
256
        return $this->discount;
257
    }
258
259
    /**
260
     * @param float $discount
261
     *
262
     * @return Item
263
     */
264
    public function setDiscount(float $discount): Item
265
    {
266
        $this->discount = $discount;
267
268
        return $this;
269
    }
270
}
271