1
|
|
|
<?php |
2
|
|
|
namespace Sesame\Model; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* Class Article |
6
|
|
|
* @package Sesame\Model |
7
|
|
|
*/ |
8
|
|
|
class Article |
9
|
|
|
{ |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
protected $description; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
protected $name; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var int |
23
|
|
|
*/ |
24
|
|
|
protected $orders; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var float |
28
|
|
|
*/ |
29
|
|
|
protected $price; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var float |
33
|
|
|
*/ |
34
|
|
|
protected $priceCurrency; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var float |
38
|
|
|
*/ |
39
|
|
|
protected $priceDiscount; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var array |
43
|
|
|
*/ |
44
|
|
|
protected $properties = array(); |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var float |
48
|
|
|
*/ |
49
|
|
|
protected $rating; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var int |
53
|
|
|
*/ |
54
|
|
|
protected $ratingAmount; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var string |
58
|
|
|
*/ |
59
|
|
|
protected $seller; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var float |
63
|
|
|
*/ |
64
|
|
|
protected $sellerFeedback; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var string |
68
|
|
|
*/ |
69
|
|
|
protected $sellerLocation; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var int |
73
|
|
|
*/ |
74
|
|
|
protected $sellerSince; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var int |
78
|
|
|
*/ |
79
|
|
|
protected $stock; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var string |
83
|
|
|
*/ |
84
|
|
|
protected $url; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return string |
88
|
|
|
*/ |
89
|
|
|
public function getDescription(): string |
90
|
|
|
{ |
91
|
|
|
return $this->description; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param string $description |
96
|
|
|
* @return Article |
97
|
|
|
*/ |
98
|
|
|
public function setDescription(string $description): Article |
99
|
|
|
{ |
100
|
|
|
$this->description = $description; |
101
|
|
|
|
102
|
|
|
return $this; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
|
|
public function getName(): string |
109
|
|
|
{ |
110
|
|
|
return $this->name; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param string $name |
115
|
|
|
* @return Article |
116
|
|
|
*/ |
117
|
|
|
public function setName(string $name): Article |
118
|
|
|
{ |
119
|
|
|
$this->name = $name; |
120
|
|
|
|
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return int |
126
|
|
|
*/ |
127
|
|
|
public function getOrders(): int |
128
|
|
|
{ |
129
|
|
|
return $this->orders; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param int $orders |
134
|
|
|
* @return Article |
135
|
|
|
*/ |
136
|
|
|
public function setOrders(int $orders): Article |
137
|
|
|
{ |
138
|
|
|
$this->orders = $orders; |
139
|
|
|
|
140
|
|
|
return $this; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @return float |
145
|
|
|
*/ |
146
|
|
|
public function getPrice(): float |
147
|
|
|
{ |
148
|
|
|
return $this->price; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @param float $price |
153
|
|
|
* @return Article |
154
|
|
|
*/ |
155
|
|
|
public function setPrice(float $price): Article |
156
|
|
|
{ |
157
|
|
|
$this->price = $price; |
158
|
|
|
|
159
|
|
|
return $this; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @return string |
164
|
|
|
*/ |
165
|
|
|
public function getPriceCurrency(): string |
166
|
|
|
{ |
167
|
|
|
return $this->priceCurrency; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @param string $priceCurrency |
172
|
|
|
* @return Article |
173
|
|
|
*/ |
174
|
|
|
public function setPriceCurrency(string $priceCurrency): Article |
175
|
|
|
{ |
176
|
|
|
$this->priceCurrency = $priceCurrency; |
|
|
|
|
177
|
|
|
|
178
|
|
|
return $this; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @return float |
183
|
|
|
*/ |
184
|
|
|
public function getPriceDiscount(): float |
185
|
|
|
{ |
186
|
|
|
return $this->priceDiscount; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param float $priceDiscount |
191
|
|
|
* @return Article |
192
|
|
|
*/ |
193
|
|
|
public function setPriceDiscount(float $priceDiscount): Article |
194
|
|
|
{ |
195
|
|
|
$this->priceDiscount = $priceDiscount; |
196
|
|
|
|
197
|
|
|
return $this; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @return array |
202
|
|
|
*/ |
203
|
|
|
public function getProperties(): array |
204
|
|
|
{ |
205
|
|
|
return $this->properties; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* @param array $properties |
210
|
|
|
* @return Article |
211
|
|
|
*/ |
212
|
|
|
public function setProperties(array $properties): Article |
213
|
|
|
{ |
214
|
|
|
$this->properties = $properties; |
215
|
|
|
|
216
|
|
|
return $this; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @return int |
221
|
|
|
*/ |
222
|
|
|
public function getRating(): int |
223
|
|
|
{ |
224
|
|
|
return $this->rating; |
|
|
|
|
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @param int $rating |
229
|
|
|
* @return Article |
230
|
|
|
*/ |
231
|
|
|
public function setRating(int $rating): Article |
232
|
|
|
{ |
233
|
|
|
$this->rating = $rating; |
234
|
|
|
|
235
|
|
|
return $this; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @return int |
240
|
|
|
*/ |
241
|
|
|
public function getRatingAmount(): int |
242
|
|
|
{ |
243
|
|
|
return $this->ratingAmount; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @param int $ratingAmount |
248
|
|
|
* @return Article |
249
|
|
|
*/ |
250
|
|
|
public function setRatingAmount(int $ratingAmount): Article |
251
|
|
|
{ |
252
|
|
|
$this->ratingAmount = $ratingAmount; |
253
|
|
|
|
254
|
|
|
return $this; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* @return string |
259
|
|
|
*/ |
260
|
|
|
public function getSeller(): string |
261
|
|
|
{ |
262
|
|
|
return $this->seller; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* @param string $seller |
267
|
|
|
* @return Article |
268
|
|
|
*/ |
269
|
|
|
public function setSeller(string $seller): Article |
270
|
|
|
{ |
271
|
|
|
$this->seller = $seller; |
272
|
|
|
|
273
|
|
|
return $this; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* @return float |
278
|
|
|
*/ |
279
|
|
|
public function getSellerFeedback(): float |
280
|
|
|
{ |
281
|
|
|
return $this->sellerFeedback; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* @param float $sellerFeedback |
286
|
|
|
* @return Article |
287
|
|
|
*/ |
288
|
|
|
public function setSellerFeedback(string $sellerFeedback): Article |
289
|
|
|
{ |
290
|
|
|
$this->sellerFeedback = $sellerFeedback; |
|
|
|
|
291
|
|
|
|
292
|
|
|
return $this; |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* @return string |
297
|
|
|
*/ |
298
|
|
|
public function getSellerLocation(): string |
299
|
|
|
{ |
300
|
|
|
return $this->sellerLocation; |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* @param string $sellerLocation |
305
|
|
|
* @return Article |
306
|
|
|
*/ |
307
|
|
|
public function setSellerLocation(string $sellerLocation): Article |
308
|
|
|
{ |
309
|
|
|
$this->sellerLocation = $sellerLocation; |
310
|
|
|
|
311
|
|
|
return $this; |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
/** |
315
|
|
|
* @return int |
316
|
|
|
*/ |
317
|
|
|
public function getSellerSince(): int |
318
|
|
|
{ |
319
|
|
|
return $this->sellerSince; |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* @param int $sellerSince |
324
|
|
|
* @return Article |
325
|
|
|
*/ |
326
|
|
|
public function setSellerSince(int $sellerSince): Article |
327
|
|
|
{ |
328
|
|
|
$this->sellerSince = $sellerSince; |
329
|
|
|
|
330
|
|
|
return $this; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* @return int |
335
|
|
|
*/ |
336
|
|
|
public function getStock(): int |
337
|
|
|
{ |
338
|
|
|
return $this->stock; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* @param int $stock |
343
|
|
|
* @return Article |
344
|
|
|
*/ |
345
|
|
|
public function setStock(int $stock): Article |
346
|
|
|
{ |
347
|
|
|
$this->stock = $stock; |
348
|
|
|
|
349
|
|
|
return $this; |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* @return string |
354
|
|
|
*/ |
355
|
|
|
public function getUrl(): string |
356
|
|
|
{ |
357
|
|
|
return $this->url; |
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
/** |
361
|
|
|
* @param string $url |
362
|
|
|
* @return Article |
363
|
|
|
*/ |
364
|
|
|
public function setUrl(string $url): Article |
365
|
|
|
{ |
366
|
|
|
$this->url = $url; |
367
|
|
|
|
368
|
|
|
return $this; |
369
|
|
|
} |
370
|
|
|
} |
371
|
|
|
|
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.