Completed
Push — master ( 7ed4f4...4f3285 )
by Ronaldo
02:55
created

Item::getTotalAmount()   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
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace WSW\SiftScience\Entities;
4
5
use WSW\Money\Money;
6
use WSW\SiftScience\Services\ItemTotalValue;
7
8
/**
9
 * Class Item
10
 *
11
 * @package WSW\SiftScience\Entities
12
 * @author Ronaldo Matos Rodrigues <[email protected]>
13
 */
14
class Item
15
{
16
    /**
17
     * @var string
18
     */
19
    private $id;
20
21
    /**
22
     * @var string
23
     */
24
    private $title;
25
26
    /**
27
     * @var Money
28
     */
29
    private $price;
30
31
    /**
32
     * @var string
33
     */
34
    private $upc;
35
    /**
36
     * @var string
37
     */
38
    private $sku;
39
40
    /**
41
     * @var string
42
     */
43
    private $brand;
44
45
    /**
46
     * @var string
47
     */
48
    private $manufacturer;
49
50
    /**
51
     * @var string
52
     */
53
    private $category;
54
55
    /**
56
     * @var array
57
     */
58
    private $tags;
59
60
    /**
61
     * @var string
62
     */
63
    private $color;
64
65
    /**
66
     * @var int
67
     */
68
    private $quantity;
69
70
    /**
71
     * @return string
72
     */
73 1
    public function getId()
74
    {
75 1
        return $this->id;
76
    }
77
78
    /**
79
     * @param string $id
80
     *
81
     * @return Item
82
     */
83 2
    public function setId($id)
84
    {
85 2
        $this->id = $id;
86
87 2
        return $this;
88
    }
89
90
    /**
91
     * @return string
92
     */
93 1
    public function getTitle()
94
    {
95 1
        return $this->title;
96
    }
97
98
    /**
99
     * @param string $title
100
     *
101
     * @return Item
102
     */
103 2
    public function setTitle($title)
104
    {
105 2
        $this->title = $title;
106
107 2
        return $this;
108
    }
109
110
    /**
111
     * @return Money
112
     */
113 1
    public function getPrice()
114
    {
115 1
        return $this->price;
116
    }
117
118
    /**
119
     * @param Money $price
120
     *
121
     * @return Item
122
     */
123 2
    public function setPrice(Money $price)
124
    {
125 2
        $this->price = $price;
126
127 2
        return $this;
128
    }
129
130
    /**
131
     * @return string
132
     */
133 1
    public function getUpc()
134
    {
135 1
        return $this->upc;
136
    }
137
138
    /**
139
     * @param string $upc
140
     *
141
     * @return Item
142
     */
143 2
    public function setUpc($upc)
144
    {
145 2
        $this->upc = $upc;
146
147 2
        return $this;
148
    }
149
150
    /**
151
     * @return string
152
     */
153 1
    public function getSku()
154
    {
155 1
        return $this->sku;
156
    }
157
158
    /**
159
     * @param string $sku
160
     *
161
     * @return Item
162
     */
163 2
    public function setSku($sku)
164
    {
165 2
        $this->sku = $sku;
166
167 2
        return $this;
168
    }
169
170
    /**
171
     * @return string
172
     */
173 1
    public function getBrand()
174
    {
175 1
        return $this->brand;
176
    }
177
178
    /**
179
     * @param string $brand
180
     *
181
     * @return Item
182
     */
183 2
    public function setBrand($brand)
184
    {
185 2
        $this->brand = $brand;
186
187 2
        return $this;
188
    }
189
190
    /**
191
     * @return string
192
     */
193 1
    public function getManufacturer()
194
    {
195 1
        return $this->manufacturer;
196
    }
197
198
    /**
199
     * @param string $manufacturer
200
     *
201
     * @return Item
202
     */
203 2
    public function setManufacturer($manufacturer)
204
    {
205 2
        $this->manufacturer = $manufacturer;
206
207 2
        return $this;
208
    }
209
210
    /**
211
     * @return string
212
     */
213 1
    public function getCategory()
214
    {
215 1
        return $this->category;
216
    }
217
218
    /**
219
     * @param string $category
220
     *
221
     * @return Item
222
     */
223 2
    public function setCategory($category)
224
    {
225 2
        $this->category = $category;
226
227 2
        return $this;
228
    }
229
230
    /**
231
     * @return array
232
     */
233 1
    public function getTags()
234
    {
235 1
        return $this->tags;
236
    }
237
238
    /**
239
     * @param array $tags
240
     *
241
     * @return Item
242
     */
243 2
    public function setTags(array $tags)
244
    {
245 2
        $this->tags = $tags;
246
247 2
        return $this;
248
    }
249
250
    /**
251
     * @return string
252
     */
253 1
    public function getColor()
254
    {
255 1
        return $this->color;
256
    }
257
258
    /**
259
     * @param string $color
260
     *
261
     * @return Item
262
     */
263 2
    public function setColor($color)
264
    {
265 2
        $this->color = $color;
266
267 2
        return $this;
268
    }
269
270
    /**
271
     * @return int
272
     */
273 1
    public function getQuantity()
274
    {
275 1
        return $this->quantity;
276
    }
277
278
    /**
279
     * @param int $quantity
280
     *
281
     * @return Item
282
     */
283 2
    public function setQuantity($quantity)
284
    {
285 2
        $this->quantity = (int) $quantity;
286
287 2
        return $this;
288
    }
289
290
    /**
291
     * @return Money
292
     */
293
    public function getTotalAmount()
294
    {
295
        return (new ItemTotalValue($this))->execute();
296
    }
297
}
298