|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the slince/shopify-api-php |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Slince <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Slince\Shopify\Manager\Order; |
|
13
|
|
|
|
|
14
|
|
|
use Slince\Shopify\Common\Model\Model; |
|
15
|
|
|
|
|
16
|
|
|
class LineItem extends Model |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var int |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $fulfillableQuantity; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var string |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $fulfillmentService; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $fulfillmentStatus; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var int |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $grams; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var float |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $price; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var int |
|
45
|
|
|
*/ |
|
46
|
|
|
protected $productId; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var int |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $quantity; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var bool |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $requiresShipping; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var string |
|
60
|
|
|
*/ |
|
61
|
|
|
protected $sku; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @var string |
|
65
|
|
|
*/ |
|
66
|
|
|
protected $title; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var int |
|
70
|
|
|
*/ |
|
71
|
|
|
protected $variantId; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @var string |
|
75
|
|
|
*/ |
|
76
|
|
|
protected $variantTitle; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @var string |
|
80
|
|
|
*/ |
|
81
|
|
|
protected $vendor; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @var string |
|
85
|
|
|
*/ |
|
86
|
|
|
protected $name; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @var bool |
|
90
|
|
|
*/ |
|
91
|
|
|
protected $giftCard; |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @var array |
|
95
|
|
|
*/ |
|
96
|
|
|
protected $properties; |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @var bool |
|
100
|
|
|
*/ |
|
101
|
|
|
protected $taxable; |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @var TaxLine[] |
|
105
|
|
|
*/ |
|
106
|
|
|
protected $taxLines; |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @var float |
|
110
|
|
|
*/ |
|
111
|
|
|
protected $totalDiscount; |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @var DiscountAllocation[] |
|
115
|
|
|
*/ |
|
116
|
|
|
protected $discountAllocations; |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @return int |
|
120
|
|
|
*/ |
|
121
|
|
|
public function getFulfillableQuantity() |
|
122
|
|
|
{ |
|
123
|
|
|
return $this->fulfillableQuantity; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @param int $fulfillableQuantity |
|
128
|
|
|
* |
|
129
|
|
|
* @return LineItem |
|
130
|
|
|
*/ |
|
131
|
|
|
public function setFulfillableQuantity($fulfillableQuantity) |
|
132
|
|
|
{ |
|
133
|
|
|
$this->fulfillableQuantity = $fulfillableQuantity; |
|
134
|
|
|
|
|
135
|
|
|
return $this; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* @return string |
|
140
|
|
|
*/ |
|
141
|
|
|
public function getFulfillmentService() |
|
142
|
|
|
{ |
|
143
|
|
|
return $this->fulfillmentService; |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* @param string $fulfillmentService |
|
148
|
|
|
* |
|
149
|
|
|
* @return LineItem |
|
150
|
|
|
*/ |
|
151
|
|
|
public function setFulfillmentService($fulfillmentService) |
|
152
|
|
|
{ |
|
153
|
|
|
$this->fulfillmentService = $fulfillmentService; |
|
154
|
|
|
|
|
155
|
|
|
return $this; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @return string |
|
160
|
|
|
*/ |
|
161
|
|
|
public function getFulfillmentStatus() |
|
162
|
|
|
{ |
|
163
|
|
|
return $this->fulfillmentStatus; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* @param string $fulfillmentStatus |
|
168
|
|
|
* |
|
169
|
|
|
* @return LineItem |
|
170
|
|
|
*/ |
|
171
|
|
|
public function setFulfillmentStatus($fulfillmentStatus) |
|
172
|
|
|
{ |
|
173
|
|
|
$this->fulfillmentStatus = $fulfillmentStatus; |
|
174
|
|
|
|
|
175
|
|
|
return $this; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @return int |
|
180
|
|
|
*/ |
|
181
|
|
|
public function getGrams() |
|
182
|
|
|
{ |
|
183
|
|
|
return $this->grams; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* @param int $grams |
|
188
|
|
|
* |
|
189
|
|
|
* @return LineItem |
|
190
|
|
|
*/ |
|
191
|
|
|
public function setGrams($grams) |
|
192
|
|
|
{ |
|
193
|
|
|
$this->grams = $grams; |
|
194
|
|
|
|
|
195
|
|
|
return $this; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* @return double |
|
200
|
|
|
*/ |
|
201
|
|
|
public function getPrice() |
|
202
|
|
|
{ |
|
203
|
|
|
return $this->price; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* @param string $price |
|
208
|
|
|
* |
|
209
|
|
|
* @return LineItem |
|
210
|
|
|
*/ |
|
211
|
|
|
public function setPrice($price) |
|
212
|
|
|
{ |
|
213
|
|
|
$this->price = $price; |
|
|
|
|
|
|
214
|
|
|
|
|
215
|
|
|
return $this; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
/** |
|
219
|
|
|
* @return int |
|
220
|
|
|
*/ |
|
221
|
|
|
public function getProductId() |
|
222
|
|
|
{ |
|
223
|
|
|
return $this->productId; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* @param int $productId |
|
228
|
|
|
* |
|
229
|
|
|
* @return LineItem |
|
230
|
|
|
*/ |
|
231
|
|
|
public function setProductId($productId) |
|
232
|
|
|
{ |
|
233
|
|
|
$this->productId = $productId; |
|
234
|
|
|
|
|
235
|
|
|
return $this; |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
/** |
|
239
|
|
|
* @return int |
|
240
|
|
|
*/ |
|
241
|
|
|
public function getQuantity() |
|
242
|
|
|
{ |
|
243
|
|
|
return $this->quantity; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
/** |
|
247
|
|
|
* @param int $quantity |
|
248
|
|
|
* |
|
249
|
|
|
* @return LineItem |
|
250
|
|
|
*/ |
|
251
|
|
|
public function setQuantity($quantity) |
|
252
|
|
|
{ |
|
253
|
|
|
$this->quantity = $quantity; |
|
254
|
|
|
|
|
255
|
|
|
return $this; |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* @return bool |
|
260
|
|
|
*/ |
|
261
|
|
|
public function isRequiresShipping() |
|
262
|
|
|
{ |
|
263
|
|
|
return $this->requiresShipping; |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
/** |
|
267
|
|
|
* @param bool $requiresShipping |
|
268
|
|
|
* |
|
269
|
|
|
* @return LineItem |
|
270
|
|
|
*/ |
|
271
|
|
|
public function setRequiresShipping($requiresShipping) |
|
272
|
|
|
{ |
|
273
|
|
|
$this->requiresShipping = $requiresShipping; |
|
274
|
|
|
|
|
275
|
|
|
return $this; |
|
276
|
|
|
} |
|
277
|
|
|
|
|
278
|
|
|
/** |
|
279
|
|
|
* @return string |
|
280
|
|
|
*/ |
|
281
|
|
|
public function getSku() |
|
282
|
|
|
{ |
|
283
|
|
|
return $this->sku; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* @param string $sku |
|
288
|
|
|
* |
|
289
|
|
|
* @return LineItem |
|
290
|
|
|
*/ |
|
291
|
|
|
public function setSku($sku) |
|
292
|
|
|
{ |
|
293
|
|
|
$this->sku = $sku; |
|
294
|
|
|
|
|
295
|
|
|
return $this; |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
/** |
|
299
|
|
|
* @return string |
|
300
|
|
|
*/ |
|
301
|
|
|
public function getTitle() |
|
302
|
|
|
{ |
|
303
|
|
|
return $this->title; |
|
304
|
|
|
} |
|
305
|
|
|
|
|
306
|
|
|
/** |
|
307
|
|
|
* @param string $title |
|
308
|
|
|
* |
|
309
|
|
|
* @return LineItem |
|
310
|
|
|
*/ |
|
311
|
|
|
public function setTitle($title) |
|
312
|
|
|
{ |
|
313
|
|
|
$this->title = $title; |
|
314
|
|
|
|
|
315
|
|
|
return $this; |
|
316
|
|
|
} |
|
317
|
|
|
|
|
318
|
|
|
/** |
|
319
|
|
|
* @return int |
|
320
|
|
|
*/ |
|
321
|
|
|
public function getVariantId() |
|
322
|
|
|
{ |
|
323
|
|
|
return $this->variantId; |
|
324
|
|
|
} |
|
325
|
|
|
|
|
326
|
|
|
/** |
|
327
|
|
|
* @param int $variantId |
|
328
|
|
|
* |
|
329
|
|
|
* @return LineItem |
|
330
|
|
|
*/ |
|
331
|
|
|
public function setVariantId($variantId) |
|
332
|
|
|
{ |
|
333
|
|
|
$this->variantId = $variantId; |
|
334
|
|
|
|
|
335
|
|
|
return $this; |
|
336
|
|
|
} |
|
337
|
|
|
|
|
338
|
|
|
/** |
|
339
|
|
|
* @return string |
|
340
|
|
|
*/ |
|
341
|
|
|
public function getVariantTitle() |
|
342
|
|
|
{ |
|
343
|
|
|
return $this->variantTitle; |
|
344
|
|
|
} |
|
345
|
|
|
|
|
346
|
|
|
/** |
|
347
|
|
|
* @param string $variantTitle |
|
348
|
|
|
* |
|
349
|
|
|
* @return LineItem |
|
350
|
|
|
*/ |
|
351
|
|
|
public function setVariantTitle($variantTitle) |
|
352
|
|
|
{ |
|
353
|
|
|
$this->variantTitle = $variantTitle; |
|
354
|
|
|
|
|
355
|
|
|
return $this; |
|
356
|
|
|
} |
|
357
|
|
|
|
|
358
|
|
|
/** |
|
359
|
|
|
* @return string |
|
360
|
|
|
*/ |
|
361
|
|
|
public function getVendor() |
|
362
|
|
|
{ |
|
363
|
|
|
return $this->vendor; |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
/** |
|
367
|
|
|
* @param string $vendor |
|
368
|
|
|
* |
|
369
|
|
|
* @return LineItem |
|
370
|
|
|
*/ |
|
371
|
|
|
public function setVendor($vendor) |
|
372
|
|
|
{ |
|
373
|
|
|
$this->vendor = $vendor; |
|
374
|
|
|
|
|
375
|
|
|
return $this; |
|
376
|
|
|
} |
|
377
|
|
|
|
|
378
|
|
|
/** |
|
379
|
|
|
* @return string |
|
380
|
|
|
*/ |
|
381
|
|
|
public function getName() |
|
382
|
|
|
{ |
|
383
|
|
|
return $this->name; |
|
384
|
|
|
} |
|
385
|
|
|
|
|
386
|
|
|
/** |
|
387
|
|
|
* @param string $name |
|
388
|
|
|
* |
|
389
|
|
|
* @return LineItem |
|
390
|
|
|
*/ |
|
391
|
|
|
public function setName($name) |
|
392
|
|
|
{ |
|
393
|
|
|
$this->name = $name; |
|
394
|
|
|
|
|
395
|
|
|
return $this; |
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
|
/** |
|
399
|
|
|
* @return bool |
|
400
|
|
|
*/ |
|
401
|
|
|
public function isGiftCard() |
|
402
|
|
|
{ |
|
403
|
|
|
return $this->giftCard; |
|
404
|
|
|
} |
|
405
|
|
|
|
|
406
|
|
|
/** |
|
407
|
|
|
* @param bool $giftCard |
|
408
|
|
|
* |
|
409
|
|
|
* @return LineItem |
|
410
|
|
|
*/ |
|
411
|
|
|
public function setGiftCard($giftCard) |
|
412
|
|
|
{ |
|
413
|
|
|
$this->giftCard = $giftCard; |
|
414
|
|
|
|
|
415
|
|
|
return $this; |
|
416
|
|
|
} |
|
417
|
|
|
|
|
418
|
|
|
/** |
|
419
|
|
|
* @return array |
|
420
|
|
|
*/ |
|
421
|
|
|
public function getProperties() |
|
422
|
|
|
{ |
|
423
|
|
|
return $this->properties; |
|
424
|
|
|
} |
|
425
|
|
|
|
|
426
|
|
|
/** |
|
427
|
|
|
* @param array $properties |
|
428
|
|
|
* |
|
429
|
|
|
* @return LineItem |
|
430
|
|
|
*/ |
|
431
|
|
|
public function setProperties($properties) |
|
432
|
|
|
{ |
|
433
|
|
|
$this->properties = $properties; |
|
434
|
|
|
|
|
435
|
|
|
return $this; |
|
436
|
|
|
} |
|
437
|
|
|
|
|
438
|
|
|
/** |
|
439
|
|
|
* @return bool |
|
440
|
|
|
*/ |
|
441
|
|
|
public function isTaxable() |
|
442
|
|
|
{ |
|
443
|
|
|
return $this->taxable; |
|
444
|
|
|
} |
|
445
|
|
|
|
|
446
|
|
|
/** |
|
447
|
|
|
* @param bool $taxable |
|
448
|
|
|
* |
|
449
|
|
|
* @return LineItem |
|
450
|
|
|
*/ |
|
451
|
|
|
public function setTaxable($taxable) |
|
452
|
|
|
{ |
|
453
|
|
|
$this->taxable = $taxable; |
|
454
|
|
|
|
|
455
|
|
|
return $this; |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
/** |
|
459
|
|
|
* @return TaxLine[] |
|
460
|
|
|
*/ |
|
461
|
|
|
public function getTaxLines() |
|
462
|
|
|
{ |
|
463
|
|
|
return $this->taxLines; |
|
464
|
|
|
} |
|
465
|
|
|
|
|
466
|
|
|
/** |
|
467
|
|
|
* @param TaxLine[] $taxLines |
|
468
|
|
|
* |
|
469
|
|
|
* @return LineItem |
|
470
|
|
|
*/ |
|
471
|
|
|
public function setTaxLines($taxLines) |
|
472
|
|
|
{ |
|
473
|
|
|
$this->taxLines = $taxLines; |
|
474
|
|
|
|
|
475
|
|
|
return $this; |
|
476
|
|
|
} |
|
477
|
|
|
|
|
478
|
|
|
/** |
|
479
|
|
|
* @return float |
|
480
|
|
|
*/ |
|
481
|
|
|
public function getTotalDiscount() |
|
482
|
|
|
{ |
|
483
|
|
|
return $this->totalDiscount; |
|
484
|
|
|
} |
|
485
|
|
|
|
|
486
|
|
|
/** |
|
487
|
|
|
* @param float $totalDiscount |
|
488
|
|
|
* |
|
489
|
|
|
* @return LineItem |
|
490
|
|
|
*/ |
|
491
|
|
|
public function setTotalDiscount($totalDiscount) |
|
492
|
|
|
{ |
|
493
|
|
|
$this->totalDiscount = $totalDiscount; |
|
494
|
|
|
|
|
495
|
|
|
return $this; |
|
496
|
|
|
} |
|
497
|
|
|
|
|
498
|
|
|
/** |
|
499
|
|
|
* @return DiscountAllocation[] |
|
500
|
|
|
*/ |
|
501
|
|
|
public function getDiscountAllocations() |
|
502
|
|
|
{ |
|
503
|
|
|
return $this->discountAllocations; |
|
504
|
|
|
} |
|
505
|
|
|
|
|
506
|
|
|
/** |
|
507
|
|
|
* @param DiscountAllocation[] $discountAllocations |
|
508
|
|
|
* |
|
509
|
|
|
* @return LineItem |
|
510
|
|
|
*/ |
|
511
|
|
|
public function setDiscountAllocations($discountAllocations) |
|
512
|
|
|
{ |
|
513
|
|
|
$this->discountAllocations = $discountAllocations; |
|
514
|
|
|
|
|
515
|
|
|
return $this; |
|
516
|
|
|
} |
|
517
|
|
|
} |
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.