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
|
|
|
* @var array |
120
|
|
|
*/ |
121
|
|
|
protected $appliedDiscount; |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @var bool |
125
|
|
|
*/ |
126
|
|
|
protected $custom; |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return bool |
130
|
|
|
*/ |
131
|
|
|
public function isCustom() |
132
|
|
|
{ |
133
|
|
|
return $this->custom; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param bool $custom |
138
|
|
|
* |
139
|
|
|
* @return LineItem |
140
|
|
|
*/ |
141
|
|
|
public function setCustom($custom) |
142
|
|
|
{ |
143
|
|
|
$this->custom = $custom; |
144
|
|
|
|
145
|
|
|
return $this; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return array |
150
|
|
|
*/ |
151
|
|
|
public function getAppliedDiscount() |
152
|
|
|
{ |
153
|
|
|
return $this->appliedDiscount; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param array $appliedDiscount |
158
|
|
|
*/ |
159
|
|
|
public function setAppliedDiscount($appliedDiscount) |
160
|
|
|
{ |
161
|
|
|
$this->appliedDiscount = $appliedDiscount; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return int |
166
|
|
|
*/ |
167
|
|
|
public function getFulfillableQuantity() |
168
|
|
|
{ |
169
|
|
|
return $this->fulfillableQuantity; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @param int $fulfillableQuantity |
174
|
|
|
* |
175
|
|
|
* @return LineItem |
176
|
|
|
*/ |
177
|
|
|
public function setFulfillableQuantity($fulfillableQuantity) |
178
|
|
|
{ |
179
|
|
|
$this->fulfillableQuantity = $fulfillableQuantity; |
180
|
|
|
|
181
|
|
|
return $this; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @return string |
186
|
|
|
*/ |
187
|
|
|
public function getFulfillmentService() |
188
|
|
|
{ |
189
|
|
|
return $this->fulfillmentService; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @param string $fulfillmentService |
194
|
|
|
* |
195
|
|
|
* @return LineItem |
196
|
|
|
*/ |
197
|
|
|
public function setFulfillmentService($fulfillmentService) |
198
|
|
|
{ |
199
|
|
|
$this->fulfillmentService = $fulfillmentService; |
200
|
|
|
|
201
|
|
|
return $this; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @return string |
206
|
|
|
*/ |
207
|
|
|
public function getFulfillmentStatus() |
208
|
|
|
{ |
209
|
|
|
return $this->fulfillmentStatus; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @param string $fulfillmentStatus |
214
|
|
|
* |
215
|
|
|
* @return LineItem |
216
|
|
|
*/ |
217
|
|
|
public function setFulfillmentStatus($fulfillmentStatus) |
218
|
|
|
{ |
219
|
|
|
$this->fulfillmentStatus = $fulfillmentStatus; |
220
|
|
|
|
221
|
|
|
return $this; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* @return int |
226
|
|
|
*/ |
227
|
|
|
public function getGrams() |
228
|
|
|
{ |
229
|
|
|
return $this->grams; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* @param int $grams |
234
|
|
|
* |
235
|
|
|
* @return LineItem |
236
|
|
|
*/ |
237
|
|
|
public function setGrams($grams) |
238
|
|
|
{ |
239
|
|
|
$this->grams = $grams; |
240
|
|
|
|
241
|
|
|
return $this; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* @return double |
246
|
|
|
*/ |
247
|
|
|
public function getPrice() |
248
|
|
|
{ |
249
|
|
|
return $this->price; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* @param string $price |
254
|
|
|
* |
255
|
|
|
* @return LineItem |
256
|
|
|
*/ |
257
|
|
|
public function setPrice($price) |
258
|
|
|
{ |
259
|
|
|
$this->price = $price; |
|
|
|
|
260
|
|
|
|
261
|
|
|
return $this; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* @return int |
266
|
|
|
*/ |
267
|
|
|
public function getProductId() |
268
|
|
|
{ |
269
|
|
|
return $this->productId; |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* @param int $productId |
274
|
|
|
* |
275
|
|
|
* @return LineItem |
276
|
|
|
*/ |
277
|
|
|
public function setProductId($productId) |
278
|
|
|
{ |
279
|
|
|
$this->productId = $productId; |
280
|
|
|
|
281
|
|
|
return $this; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* @return int |
286
|
|
|
*/ |
287
|
|
|
public function getQuantity() |
288
|
|
|
{ |
289
|
|
|
return $this->quantity; |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
/** |
293
|
|
|
* @param int $quantity |
294
|
|
|
* |
295
|
|
|
* @return LineItem |
296
|
|
|
*/ |
297
|
|
|
public function setQuantity($quantity) |
298
|
|
|
{ |
299
|
|
|
$this->quantity = $quantity; |
300
|
|
|
|
301
|
|
|
return $this; |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* @return bool |
306
|
|
|
*/ |
307
|
|
|
public function isRequiresShipping() |
308
|
|
|
{ |
309
|
|
|
return $this->requiresShipping; |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* @param bool $requiresShipping |
314
|
|
|
* |
315
|
|
|
* @return LineItem |
316
|
|
|
*/ |
317
|
|
|
public function setRequiresShipping($requiresShipping) |
318
|
|
|
{ |
319
|
|
|
$this->requiresShipping = $requiresShipping; |
320
|
|
|
|
321
|
|
|
return $this; |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* @return string |
326
|
|
|
*/ |
327
|
|
|
public function getSku() |
328
|
|
|
{ |
329
|
|
|
return $this->sku; |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
/** |
333
|
|
|
* @param string $sku |
334
|
|
|
* |
335
|
|
|
* @return LineItem |
336
|
|
|
*/ |
337
|
|
|
public function setSku($sku) |
338
|
|
|
{ |
339
|
|
|
$this->sku = $sku; |
340
|
|
|
|
341
|
|
|
return $this; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* @return string |
346
|
|
|
*/ |
347
|
|
|
public function getTitle() |
348
|
|
|
{ |
349
|
|
|
return $this->title; |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* @param string $title |
354
|
|
|
* |
355
|
|
|
* @return LineItem |
356
|
|
|
*/ |
357
|
|
|
public function setTitle($title) |
358
|
|
|
{ |
359
|
|
|
$this->title = $title; |
360
|
|
|
|
361
|
|
|
return $this; |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* @return int |
366
|
|
|
*/ |
367
|
|
|
public function getVariantId() |
368
|
|
|
{ |
369
|
|
|
return $this->variantId; |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
/** |
373
|
|
|
* @param int $variantId |
374
|
|
|
* |
375
|
|
|
* @return LineItem |
376
|
|
|
*/ |
377
|
|
|
public function setVariantId($variantId) |
378
|
|
|
{ |
379
|
|
|
$this->variantId = $variantId; |
380
|
|
|
|
381
|
|
|
return $this; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
/** |
385
|
|
|
* @return string |
386
|
|
|
*/ |
387
|
|
|
public function getVariantTitle() |
388
|
|
|
{ |
389
|
|
|
return $this->variantTitle; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
/** |
393
|
|
|
* @param string $variantTitle |
394
|
|
|
* |
395
|
|
|
* @return LineItem |
396
|
|
|
*/ |
397
|
|
|
public function setVariantTitle($variantTitle) |
398
|
|
|
{ |
399
|
|
|
$this->variantTitle = $variantTitle; |
400
|
|
|
|
401
|
|
|
return $this; |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
/** |
405
|
|
|
* @return string |
406
|
|
|
*/ |
407
|
|
|
public function getVendor() |
408
|
|
|
{ |
409
|
|
|
return $this->vendor; |
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
/** |
413
|
|
|
* @param string $vendor |
414
|
|
|
* |
415
|
|
|
* @return LineItem |
416
|
|
|
*/ |
417
|
|
|
public function setVendor($vendor) |
418
|
|
|
{ |
419
|
|
|
$this->vendor = $vendor; |
420
|
|
|
|
421
|
|
|
return $this; |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
/** |
425
|
|
|
* @return string |
426
|
|
|
*/ |
427
|
|
|
public function getName() |
428
|
|
|
{ |
429
|
|
|
return $this->name; |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
/** |
433
|
|
|
* @param string $name |
434
|
|
|
* |
435
|
|
|
* @return LineItem |
436
|
|
|
*/ |
437
|
|
|
public function setName($name) |
438
|
|
|
{ |
439
|
|
|
$this->name = $name; |
440
|
|
|
|
441
|
|
|
return $this; |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
/** |
445
|
|
|
* @return bool |
446
|
|
|
*/ |
447
|
|
|
public function isGiftCard() |
448
|
|
|
{ |
449
|
|
|
return $this->giftCard; |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* @param bool $giftCard |
454
|
|
|
* |
455
|
|
|
* @return LineItem |
456
|
|
|
*/ |
457
|
|
|
public function setGiftCard($giftCard) |
458
|
|
|
{ |
459
|
|
|
$this->giftCard = $giftCard; |
460
|
|
|
|
461
|
|
|
return $this; |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
/** |
465
|
|
|
* @return array |
466
|
|
|
*/ |
467
|
|
|
public function getProperties() |
468
|
|
|
{ |
469
|
|
|
return $this->properties; |
470
|
|
|
} |
471
|
|
|
|
472
|
|
|
/** |
473
|
|
|
* @param array $properties |
474
|
|
|
* |
475
|
|
|
* @return LineItem |
476
|
|
|
*/ |
477
|
|
|
public function setProperties($properties) |
478
|
|
|
{ |
479
|
|
|
$this->properties = $properties; |
480
|
|
|
|
481
|
|
|
return $this; |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
/** |
485
|
|
|
* @return bool |
486
|
|
|
*/ |
487
|
|
|
public function isTaxable() |
488
|
|
|
{ |
489
|
|
|
return $this->taxable; |
490
|
|
|
} |
491
|
|
|
|
492
|
|
|
/** |
493
|
|
|
* @param bool $taxable |
494
|
|
|
* |
495
|
|
|
* @return LineItem |
496
|
|
|
*/ |
497
|
|
|
public function setTaxable($taxable) |
498
|
|
|
{ |
499
|
|
|
$this->taxable = $taxable; |
500
|
|
|
|
501
|
|
|
return $this; |
502
|
|
|
} |
503
|
|
|
|
504
|
|
|
/** |
505
|
|
|
* @return TaxLine[] |
506
|
|
|
*/ |
507
|
|
|
public function getTaxLines() |
508
|
|
|
{ |
509
|
|
|
return $this->taxLines; |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
/** |
513
|
|
|
* @param TaxLine[] $taxLines |
514
|
|
|
* |
515
|
|
|
* @return LineItem |
516
|
|
|
*/ |
517
|
|
|
public function setTaxLines($taxLines) |
518
|
|
|
{ |
519
|
|
|
$this->taxLines = $taxLines; |
520
|
|
|
|
521
|
|
|
return $this; |
522
|
|
|
} |
523
|
|
|
|
524
|
|
|
/** |
525
|
|
|
* @return float |
526
|
|
|
*/ |
527
|
|
|
public function getTotalDiscount() |
528
|
|
|
{ |
529
|
|
|
return $this->totalDiscount; |
530
|
|
|
} |
531
|
|
|
|
532
|
|
|
/** |
533
|
|
|
* @param float $totalDiscount |
534
|
|
|
* |
535
|
|
|
* @return LineItem |
536
|
|
|
*/ |
537
|
|
|
public function setTotalDiscount($totalDiscount) |
538
|
|
|
{ |
539
|
|
|
$this->totalDiscount = $totalDiscount; |
540
|
|
|
|
541
|
|
|
return $this; |
542
|
|
|
} |
543
|
|
|
|
544
|
|
|
/** |
545
|
|
|
* @return DiscountAllocation[] |
546
|
|
|
*/ |
547
|
|
|
public function getDiscountAllocations() |
548
|
|
|
{ |
549
|
|
|
return $this->discountAllocations; |
550
|
|
|
} |
551
|
|
|
|
552
|
|
|
/** |
553
|
|
|
* @param DiscountAllocation[] $discountAllocations |
554
|
|
|
* |
555
|
|
|
* @return LineItem |
556
|
|
|
*/ |
557
|
|
|
public function setDiscountAllocations($discountAllocations) |
558
|
|
|
{ |
559
|
|
|
$this->discountAllocations = $discountAllocations; |
560
|
|
|
|
561
|
|
|
return $this; |
562
|
|
|
} |
563
|
|
|
} |
564
|
|
|
|
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.