Completed
Push — master ( 2cf029...6368d5 )
by Joachim
12:58
created

Order::populateFromApiResponse()   D

Complexity

Conditions 9
Paths 129

Size

Total Lines 112
Code Lines 77

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 9
eloc 77
nc 129
nop 2
dl 0
loc 112
rs 4.606
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A Order::hasOrderLine() 0 8 2
A Order::getShippingMethodFee() 0 3 1
A Order::setTotalPrice() 0 5 1
A Order::setSalesDiscount() 0 5 1
A Order::removeOrderLine() 0 5 1
A Order::getSalesDiscount() 0 3 1
A Order::getTotalPrice() 0 3 1
A Order::setShippingMethodFee() 0 5 1
A Order::getGiftCertificateAmount() 0 3 1
A Order::setGiftCertificateAmount() 0 5 1
A Order::clearOrderLines() 0 5 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Loevgaard\DandomainFoundation\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable;
8
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable;
9
use Loevgaard\DandomainDateTime\DateTimeImmutable;
10
use Loevgaard\DandomainFoundation;
11
use Loevgaard\DandomainFoundation\Entity\Generated\CustomerInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...rated\CustomerInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Loevgaard\DandomainFoundation\Entity\Generated\DeliveryInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...rated\DeliveryInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Loevgaard\DandomainFoundation\Entity\Generated\InvoiceInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...erated\InvoiceInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Loevgaard\DandomainFoundation\Entity\Generated\OrderInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...enerated\OrderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Loevgaard\DandomainFoundation\Entity\Generated\OrderLineInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...ated\OrderLineInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Loevgaard\DandomainFoundation\Entity\Generated\OrderTrait;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...ty\Generated\OrderTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Loevgaard\DandomainFoundation\Entity\Generated\PaymentMethodInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...\PaymentMethodInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Loevgaard\DandomainFoundation\Entity\Generated\ShippingMethodInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...ShippingMethodInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use Loevgaard\DandomainFoundation\Entity\Generated\SiteInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...Generated\SiteInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
use Loevgaard\DandomainFoundation\Entity\Generated\StateInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...enerated\StateInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
use Money\Money;
22
23
/**
24
 * We use the Money library for amounts, and we use a shared currency, namely the property $currencyCode
25
 *
26
 * @ORM\Entity()
27
 * @ORM\Table(name="ldf_orders")
28
 */
29
class Order extends AbstractEntity implements OrderInterface
30
{
31
    use OrderTrait;
32
    use Timestampable;
33
    use SoftDeletable;
34
35
    /**
36
     * @var int
37
     *
38
     * @ORM\Id
39
     * @ORM\GeneratedValue
40
     * @ORM\Column(type="integer")
41
     **/
42
    protected $id;
43
44
    /**
45
     * This is the order id in Dandomain
46
     *
47
     * @var int
48
     *
49
     * @ORM\Column(type="integer", unique=true)
50
     */
51
    protected $externalId;
52
53
    /**
54
     * @var CustomerInterface|null
55
     *
56
     * @ORM\JoinColumn(onDelete="SET NULL")
57
     * @ORM\ManyToOne(targetEntity="Customer", cascade={"persist", "remove"})
58
     */
59
    protected $customer;
60
61
    /**
62
     * @var DeliveryInterface|null
63
     *
64
     * @ORM\JoinColumn(onDelete="SET NULL")
65
     * @ORM\ManyToOne(targetEntity="Delivery", cascade={"persist", "remove"})
66
     */
67
    protected $delivery;
68
69
    /**
70
     * @var InvoiceInterface|null
71
     *
72
     * @ORM\JoinColumn(onDelete="SET NULL")
73
     * @ORM\ManyToOne(targetEntity="Invoice", cascade={"persist", "remove"})
74
     */
75
    protected $invoice;
76
77
    /**
78
     * @var OrderLine[]|ArrayCollection
79
     *
80
     * @ORM\OneToMany(mappedBy="order", targetEntity="OrderLine", cascade={"persist", "remove"}, orphanRemoval=true)
81
     */
82
    protected $orderLines;
83
84
    /**
85
     * @var PaymentMethodInterface|null
86
     *
87
     * @ORM\JoinColumn(onDelete="SET NULL")
88
     * @ORM\ManyToOne(targetEntity="PaymentMethod", cascade={"persist", "remove"})
89
     */
90
    protected $paymentMethod;
91
92
    /**
93
     * Because the fee can change on the payment method we have a field for here for the fee on this order
94
     *
95
     * @var integer|null
96
     *
97
     * @ORM\Column(type="integer", nullable=true)
98
     */
99
    protected $paymentMethodFee;
100
101
    /**
102
     * @var ShippingMethodInterface|null
103
     *
104
     * @ORM\JoinColumn(onDelete="SET NULL")
105
     * @ORM\ManyToOne(targetEntity="ShippingMethod", cascade={"persist", "remove"})
106
     */
107
    protected $shippingMethod;
108
109
    /**
110
     * Because the fee can change on the shipping method we have a field for here for the fee on this order
111
     *
112
     * @var integer|null
113
     *
114
     * @ORM\Column(type="integer", nullable=true)
115
     */
116
    protected $shippingMethodFee;
117
118
    /**
119
     * @var SiteInterface|null
120
     *
121
     * @ORM\JoinColumn(onDelete="SET NULL")
122
     * @ORM\ManyToOne(targetEntity="Site", cascade={"persist", "remove"})
123
     */
124
    protected $site;
125
126
    /**
127
     * @var StateInterface|null
128
     *
129
     * @ORM\JoinColumn(onDelete="SET NULL")
130
     * @ORM\ManyToOne(targetEntity="State", cascade={"persist", "remove"})
131
     */
132
    protected $state;
133
134
    /**
135
     * @var string|null
136
     *
137
     * @ORM\Column(nullable=true, type="text")
138
     */
139
    protected $comment;
140
141
    /**
142
     * @var \DateTimeImmutable|null
143
     *
144
     * @ORM\Column(nullable=true, type="datetime_immutable", options={"comment"="Created info from Dandomain"})
145
     */
146
    protected $createdDate;
147
148
    /**
149
     * @var string|null
150
     *
151
     * @ORM\Column(nullable=true, type="string", length=191)
152
     */
153
    protected $creditNoteNumber;
154
155
    /**
156
     * @var string|null
157
     *
158
     * @ORM\Column(type="string", length=3, nullable=true)
159
     */
160
    protected $currencyCode;
161
162
    /**
163
     * @var string|null
164
     *
165
     * @ORM\Column(nullable=true, type="text")
166
     */
167
    protected $customerComment;
168
169
    /**
170
     * @var integer|null
171
     *
172
     * @ORM\Column(type="integer", nullable=true)
173
     */
174
    protected $giftCertificateAmount;
175
176
    /**
177
     * @var string|null
178
     *
179
     * @ORM\Column(nullable=true, type="string", length=191)
180
     */
181
    protected $giftCertificateNumber;
182
183
    /**
184
     * @var bool|null
185
     *
186
     * @ORM\Column(type="boolean", nullable=true)
187
     */
188
    protected $incomplete;
189
190
    /**
191
     * @var string|null
192
     *
193
     * @ORM\Column(nullable=true, type="string", length=191)
194
     */
195
    protected $ip;
196
197
    /**
198
     * @var bool|null
199
     *
200
     * @ORM\Column(type="boolean", nullable=true)
201
     */
202
    protected $modified;
203
204
    /**
205
     * @var \DateTimeImmutable|null
206
     *
207
     * @ORM\Column(nullable=true, type="datetime_immutable", options={"comment"="Modified info from Dandomain"})
208
     */
209
    protected $modifiedDate;
210
211
    /**
212
     * @var string|null
213
     *
214
     * @ORM\Column(nullable=true, type="string", length=191)
215
     */
216
    protected $referenceNumber;
217
218
    /**
219
     * @var string|null
220
     *
221
     * @ORM\Column(nullable=true, type="text")
222
     */
223
    protected $referrer;
224
225
    /**
226
     * @var string|null
227
     *
228
     * @ORM\Column(nullable=true, type="string", length=191)
229
     */
230
    protected $reservedField1;
231
232
    /**
233
     * @var string|null
234
     *
235
     * @ORM\Column(nullable=true, type="string", length=191)
236
     */
237
    protected $reservedField2;
238
239
    /**
240
     * @var string|null
241
     *
242
     * @ORM\Column(nullable=true, type="string", length=191)
243
     */
244
    protected $reservedField3;
245
246
    /**
247
     * @var string|null
248
     *
249
     * @ORM\Column(nullable=true, type="string", length=191)
250
     */
251
    protected $reservedField4;
252
253
    /**
254
     * @var string|null
255
     *
256
     * @ORM\Column(nullable=true, type="string", length=191)
257
     */
258
    protected $reservedField5;
259
260
    /**
261
     * @var int|null
262
     *
263
     * @ORM\Column(type="integer", nullable=true)
264
     */
265
    protected $salesDiscount;
266
267
    /**
268
     * @var int|null
269
     *
270
     * @ORM\Column(type="integer", nullable=true)
271
     */
272
    protected $totalPrice;
273
274
    /**
275
     * @var float|null
276
     *
277
     * @ORM\Column(nullable=true, type="decimal", precision=12, scale=2)
278
     */
279
    protected $totalWeight;
280
281
    /**
282
     * @var string|null
283
     *
284
     * @ORM\Column(nullable=true, type="string", length=191)
285
     */
286
    protected $trackingNumber;
287
288
    /**
289
     * @var int|null
290
     *
291
     * @ORM\Column(nullable=true, type="string", length=191)
292
     */
293
    protected $transactionNumber;
294
295
    /**
296
     * @var float|null
297
     *
298
     * @ORM\Column(nullable=true, type="decimal", precision=5, scale=2)
299
     */
300
    protected $vatPct;
301
302
    /**
303
     * @var string|null
304
     *
305
     * @ORM\Column(nullable=true, type="string", length=191)
306
     */
307
    protected $vatRegNumber;
308
309
    /**
310
     * @var string|null
311
     *
312
     * @ORM\Column(nullable=true, type="text")
313
     */
314
    protected $xmlParams;
315
316
    public function __construct()
317
    {
318
        $this->orderLines = new ArrayCollection();
319
    }
320
321
    /*
322
     * Collection methods
323
     */
324
    public function addOrderLine(OrderLineInterface $orderLine) : OrderInterface
325
    {
326
        if(!$this->hasOrderLine($orderLine)) {
327
            $this->orderLines->add($orderLine);
328
            $orderLine->setOrder($this);
329
        }
330
331
        return $this;
332
    }
333
334
    /**
335
     * @param OrderLineInterface|int $orderLine Either the OrderLineInterface or the external id
336
     * @return bool
337
     */
338
    public function hasOrderLine($orderLine) : bool
339
    {
340
        if($orderLine instanceof OrderLineInterface) {
341
            $orderLine = $orderLine->getExternalId();
342
        }
343
344
        return $this->orderLines->exists(function($key, OrderLineInterface $element) use ($orderLine) {
345
            return $element->getExternalId() === $orderLine;
346
        });
347
    }
348
349
    public function removeOrderLine(OrderLineInterface $orderLine) : OrderInterface
350
    {
351
        $this->orderLines->removeElement($orderLine);
352
353
        return $this;
354
    }
355
356
    public function clearOrderLines() : OrderInterface
357
    {
358
        $this->orderLines->clear();
359
360
        return $this;
361
    }
362
363
    /*
364
     * Getters / Setters
365
     */
366
    /**
367
     * @return Money|null
368
     */
369
    public function getTotalPrice() : ?Money
370
    {
371
        return $this->createMoney((int)$this->totalPrice);
372
    }
373
374
    /**
375
     * @param Money $money
376
     * @return OrderInterface
377
     */
378
    public function setTotalPrice(Money $money = null) : OrderInterface
379
    {
380
        $this->totalPrice = $money->getAmount();
0 ignored issues
show
Bug introduced by
The method getAmount() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

380
        /** @scrutinizer ignore-call */ 
381
        $this->totalPrice = $money->getAmount();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $totalPrice.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
381
382
        return $this;
383
    }
384
385
    /**
386
     * @return Money|null
387
     */
388
    public function getSalesDiscount() : ?Money
389
    {
390
        return $this->createMoney((int)$this->salesDiscount);
391
    }
392
393
    /**
394
     * @param Money $money
395
     * @return OrderInterface
396
     */
397
    public function setSalesDiscount(Money $money = null) : OrderInterface
398
    {
399
        $this->salesDiscount = $money->getAmount();
0 ignored issues
show
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $salesDiscount.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
400
401
        return $this;
402
    }
403
404
    /**
405
     * @return Money|null
406
     */
407
    public function getGiftCertificateAmount() : ?Money
408
    {
409
        return $this->createMoney((int)$this->giftCertificateAmount);
410
    }
411
412
    /**
413
     * @param Money $money
414
     * @return OrderInterface
415
     */
416
    public function setGiftCertificateAmount(Money $money = null) : OrderInterface
417
    {
418
        $this->giftCertificateAmount = $money->getAmount();
0 ignored issues
show
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $giftCertificateAmount.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
419
420
        return $this;
421
    }
422
423
    /**
424
     * @return Money|null
425
     */
426
    public function getShippingMethodFee() : ?Money
427
    {
428
        return $this->createMoney((int)$this->shippingMethodFee);
429
    }
430
431
    /**
432
     * @param Money $money
433
     * @return OrderInterface
434
     */
435
    public function setShippingMethodFee(Money $money = null) : OrderInterface
436
    {
437
        $this->shippingMethodFee = $money->getAmount();
0 ignored issues
show
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $shippingMethodFee.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
438
439
        return $this;
440
    }
441
442
    /**
443
     * @return Money|null
444
     */
445
    public function getPaymentMethodFee() : ?Money
446
    {
447
        return $this->createMoney((int)$this->paymentMethodFee);
448
    }
449
450
    /**
451
     * @param Money $money
452
     * @return OrderInterface
453
     */
454
    public function setPaymentMethodFee(Money $money = null) : OrderInterface
455
    {
456
        $this->paymentMethodFee = $money->getAmount();
0 ignored issues
show
Documentation Bug introduced by
It seems like $money->getAmount() of type string is incompatible with the declared type null|integer of property $paymentMethodFee.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
457
458
        return $this;
459
    }
460
461
    /**
462
     * @return int
463
     */
464
    public function getId(): int
465
    {
466
        return (int)$this->id;
467
    }
468
469
    /**
470
     * @param int $id
471
     * @return OrderInterface
472
     */
473
    public function setId($id)
474
    {
475
        $this->id = $id;
476
        return $this;
477
    }
478
479
    /**
480
     * @return int
481
     */
482
    public function getExternalId(): int
483
    {
484
        return $this->externalId;
485
    }
486
487
    /**
488
     * @param int $externalId
489
     * @return OrderInterface
490
     */
491
    public function setExternalId($externalId)
492
    {
493
        $this->externalId = $externalId;
494
        return $this;
495
    }
496
497
    /**
498
     * @return CustomerInterface|null
499
     */
500
    public function getCustomer()
501
    {
502
        return $this->customer;
503
    }
504
505
    /**
506
     * @param CustomerInterface|null $customer
507
     * @return OrderInterface
508
     */
509
    public function setCustomer($customer)
510
    {
511
        $this->customer = $customer;
512
        return $this;
513
    }
514
515
    /**
516
     * @return DeliveryInterface|null
517
     */
518
    public function getDelivery()
519
    {
520
        return $this->delivery;
521
    }
522
523
    /**
524
     * @param DeliveryInterface|null $delivery
525
     * @return OrderInterface
526
     */
527
    public function setDelivery($delivery)
528
    {
529
        $this->delivery = $delivery;
530
        return $this;
531
    }
532
533
    /**
534
     * @return InvoiceInterface|null
535
     */
536
    public function getInvoice()
537
    {
538
        return $this->invoice;
539
    }
540
541
    /**
542
     * @param InvoiceInterface|null $invoice
543
     * @return OrderInterface
544
     */
545
    public function setInvoice($invoice)
546
    {
547
        $this->invoice = $invoice;
548
        return $this;
549
    }
550
551
    /**
552
     * @return ArrayCollection|null
553
     */
554
    public function getOrderLines()
555
    {
556
        return $this->orderLines;
557
    }
558
559
    /**
560
     * @param ArrayCollection|null $orderLines
561
     * @return OrderInterface
562
     */
563
    public function setOrderLines($orderLines)
564
    {
565
        $this->orderLines = $orderLines;
566
        return $this;
567
    }
568
569
    /**
570
     * @return PaymentMethodInterface|null
571
     */
572
    public function getPaymentMethod()
573
    {
574
        return $this->paymentMethod;
575
    }
576
577
    /**
578
     * @param PaymentMethodInterface|null $paymentMethod
579
     * @return OrderInterface
580
     */
581
    public function setPaymentMethod($paymentMethod)
582
    {
583
        $this->paymentMethod = $paymentMethod;
584
        return $this;
585
    }
586
587
    /**
588
     * @return ShippingMethodInterface|null
589
     */
590
    public function getShippingMethod()
591
    {
592
        return $this->shippingMethod;
593
    }
594
595
    /**
596
     * @param ShippingMethodInterface|null $shippingMethod
597
     * @return OrderInterface
598
     */
599
    public function setShippingMethod($shippingMethod)
600
    {
601
        $this->shippingMethod = $shippingMethod;
602
        return $this;
603
    }
604
605
    /**
606
     * @return SiteInterface|null
607
     */
608
    public function getSite()
609
    {
610
        return $this->site;
611
    }
612
613
    /**
614
     * @param SiteInterface|null $site
615
     * @return OrderInterface
616
     */
617
    public function setSite($site)
618
    {
619
        $this->site = $site;
620
        return $this;
621
    }
622
623
    /**
624
     * @return StateInterface|null
625
     */
626
    public function getState()
627
    {
628
        return $this->state;
629
    }
630
631
    /**
632
     * @param StateInterface|null $state
633
     * @return OrderInterface
634
     */
635
    public function setState($state)
636
    {
637
        $this->state = $state;
638
        return $this;
639
    }
640
641
    /**
642
     * @return null|string
643
     */
644
    public function getComment()
645
    {
646
        return $this->comment;
647
    }
648
649
    /**
650
     * @param null|string $comment
651
     * @return OrderInterface
652
     */
653
    public function setComment($comment)
654
    {
655
        $this->comment = $comment;
656
        return $this;
657
    }
658
659
    /**
660
     * @return \DateTimeImmutable|null
661
     */
662
    public function getCreatedDate()
663
    {
664
        return $this->createdDate;
665
    }
666
667
    /**
668
     * @param \DateTimeImmutable|null $createdDate
669
     * @return OrderInterface
670
     */
671
    public function setCreatedDate($createdDate)
672
    {
673
        $this->createdDate = $createdDate;
674
        return $this;
675
    }
676
677
    /**
678
     * @return null|string
679
     */
680
    public function getCreditNoteNumber()
681
    {
682
        return $this->creditNoteNumber;
683
    }
684
685
    /**
686
     * @param null|string $creditNoteNumber
687
     * @return Order
688
     */
689
    public function setCreditNoteNumber($creditNoteNumber)
690
    {
691
        $this->creditNoteNumber = $creditNoteNumber;
692
        return $this;
693
    }
694
695
    /**
696
     * @return null|string
697
     */
698
    public function getCurrencyCode()
699
    {
700
        return $this->currencyCode;
701
    }
702
703
    /**
704
     * @param null|string $currencyCode
705
     * @return OrderInterface
706
     */
707
    public function setCurrencyCode($currencyCode)
708
    {
709
        $this->currencyCode = $currencyCode;
710
        return $this;
711
    }
712
713
    /**
714
     * @return null|string
715
     */
716
    public function getCustomerComment()
717
    {
718
        return $this->customerComment;
719
    }
720
721
    /**
722
     * @param null|string $customerComment
723
     * @return OrderInterface
724
     */
725
    public function setCustomerComment($customerComment)
726
    {
727
        $this->customerComment = $customerComment;
728
        return $this;
729
    }
730
731
    /**
732
     * @return null|string
733
     */
734
    public function getGiftCertificateNumber()
735
    {
736
        return $this->giftCertificateNumber;
737
    }
738
739
    /**
740
     * @param null|string $giftCertificateNumber
741
     * @return OrderInterface
742
     */
743
    public function setGiftCertificateNumber($giftCertificateNumber)
744
    {
745
        $this->giftCertificateNumber = $giftCertificateNumber;
746
        return $this;
747
    }
748
749
    /**
750
     * @return bool|null
751
     */
752
    public function getIncomplete()
753
    {
754
        return $this->incomplete;
755
    }
756
757
    /**
758
     * @param bool|null $incomplete
759
     * @return OrderInterface
760
     */
761
    public function setIncomplete($incomplete)
762
    {
763
        $this->incomplete = $incomplete;
764
        return $this;
765
    }
766
767
    /**
768
     * @return null|string
769
     */
770
    public function getIp()
771
    {
772
        return $this->ip;
773
    }
774
775
    /**
776
     * @param null|string $ip
777
     * @return OrderInterface
778
     */
779
    public function setIp($ip)
780
    {
781
        $this->ip = $ip;
782
        return $this;
783
    }
784
785
    /**
786
     * @return bool|null
787
     */
788
    public function getModified()
789
    {
790
        return $this->modified;
791
    }
792
793
    /**
794
     * @param bool|null $modified
795
     * @return OrderInterface
796
     */
797
    public function setModified($modified)
798
    {
799
        $this->modified = $modified;
800
        return $this;
801
    }
802
803
    /**
804
     * @return \DateTimeImmutable|null
805
     */
806
    public function getModifiedDate()
807
    {
808
        return $this->modifiedDate;
809
    }
810
811
    /**
812
     * @param \DateTimeImmutable|null $modifiedDate
813
     * @return OrderInterface
814
     */
815
    public function setModifiedDate($modifiedDate)
816
    {
817
        $this->modifiedDate = $modifiedDate;
818
        return $this;
819
    }
820
821
    /**
822
     * @return null|string
823
     */
824
    public function getReferenceNumber()
825
    {
826
        return $this->referenceNumber;
827
    }
828
829
    /**
830
     * @param null|string $referenceNumber
831
     * @return OrderInterface
832
     */
833
    public function setReferenceNumber($referenceNumber)
834
    {
835
        $this->referenceNumber = $referenceNumber;
836
        return $this;
837
    }
838
839
    /**
840
     * @return null|string
841
     */
842
    public function getReferrer()
843
    {
844
        return $this->referrer;
845
    }
846
847
    /**
848
     * @param null|string $referrer
849
     * @return OrderInterface
850
     */
851
    public function setReferrer($referrer)
852
    {
853
        $this->referrer = $referrer;
854
        return $this;
855
    }
856
857
    /**
858
     * @return null|string
859
     */
860
    public function getReservedField1()
861
    {
862
        return $this->reservedField1;
863
    }
864
865
    /**
866
     * @param null|string $reservedField1
867
     * @return OrderInterface
868
     */
869
    public function setReservedField1($reservedField1)
870
    {
871
        $this->reservedField1 = $reservedField1;
872
        return $this;
873
    }
874
875
    /**
876
     * @return null|string
877
     */
878
    public function getReservedField2()
879
    {
880
        return $this->reservedField2;
881
    }
882
883
    /**
884
     * @param null|string $reservedField2
885
     * @return OrderInterface
886
     */
887
    public function setReservedField2($reservedField2)
888
    {
889
        $this->reservedField2 = $reservedField2;
890
        return $this;
891
    }
892
893
    /**
894
     * @return null|string
895
     */
896
    public function getReservedField3()
897
    {
898
        return $this->reservedField3;
899
    }
900
901
    /**
902
     * @param null|string $reservedField3
903
     * @return OrderInterface
904
     */
905
    public function setReservedField3($reservedField3)
906
    {
907
        $this->reservedField3 = $reservedField3;
908
        return $this;
909
    }
910
911
    /**
912
     * @return null|string
913
     */
914
    public function getReservedField4()
915
    {
916
        return $this->reservedField4;
917
    }
918
919
    /**
920
     * @param null|string $reservedField4
921
     * @return OrderInterface
922
     */
923
    public function setReservedField4($reservedField4)
924
    {
925
        $this->reservedField4 = $reservedField4;
926
        return $this;
927
    }
928
929
    /**
930
     * @return null|string
931
     */
932
    public function getReservedField5()
933
    {
934
        return $this->reservedField5;
935
    }
936
937
    /**
938
     * @param null|string $reservedField5
939
     * @return OrderInterface
940
     */
941
    public function setReservedField5($reservedField5)
942
    {
943
        $this->reservedField5 = $reservedField5;
944
        return $this;
945
    }
946
947
    /**
948
     * @return float|null
949
     */
950
    public function getTotalWeight()
951
    {
952
        return $this->totalWeight;
953
    }
954
955
    /**
956
     * @param float|null $totalWeight
957
     * @return OrderInterface
958
     */
959
    public function setTotalWeight($totalWeight)
960
    {
961
        $this->totalWeight = $totalWeight;
962
        return $this;
963
    }
964
965
    /**
966
     * @return null|string
967
     */
968
    public function getTrackingNumber()
969
    {
970
        return $this->trackingNumber;
971
    }
972
973
    /**
974
     * @param null|string $trackingNumber
975
     * @return OrderInterface
976
     */
977
    public function setTrackingNumber($trackingNumber)
978
    {
979
        $this->trackingNumber = $trackingNumber;
980
        return $this;
981
    }
982
983
    /**
984
     * @return int|null
985
     */
986
    public function getTransactionNumber()
987
    {
988
        return $this->transactionNumber;
989
    }
990
991
    /**
992
     * @param int|null $transactionNumber
993
     * @return OrderInterface
994
     */
995
    public function setTransactionNumber($transactionNumber)
996
    {
997
        $this->transactionNumber = $transactionNumber;
998
        return $this;
999
    }
1000
1001
    /**
1002
     * @return float|null
1003
     */
1004
    public function getVatPct()
1005
    {
1006
        return $this->vatPct;
1007
    }
1008
1009
    /**
1010
     * @param float|null $vatPct
1011
     * @return OrderInterface
1012
     */
1013
    public function setVatPct($vatPct)
1014
    {
1015
        $this->vatPct = $vatPct;
1016
        return $this;
1017
    }
1018
1019
    /**
1020
     * @return null|string
1021
     */
1022
    public function getVatRegNumber()
1023
    {
1024
        return $this->vatRegNumber;
1025
    }
1026
1027
    /**
1028
     * @param null|string $vatRegNumber
1029
     * @return OrderInterface
1030
     */
1031
    public function setVatRegNumber($vatRegNumber)
1032
    {
1033
        $this->vatRegNumber = $vatRegNumber;
1034
        return $this;
1035
    }
1036
1037
    /**
1038
     * @return null|string
1039
     */
1040
    public function getXmlParams()
1041
    {
1042
        return $this->xmlParams;
1043
    }
1044
1045
    /**
1046
     * @param null|string $xmlParams
1047
     * @return OrderInterface
1048
     */
1049
    public function setXmlParams($xmlParams)
1050
    {
1051
        $this->xmlParams = $xmlParams;
1052
        return $this;
1053
    }
1054
1055
    /**
1056
     * A helper method for creating a Money object from a float based on the shared currency
1057
     *
1058
     * @param int $amount
1059
     * @return Money|null
1060
     */
1061
    private function createMoney(int $amount = 0) : ?Money
1062
    {
1063
        return DandomainFoundation\createMoney((string)$this->currencyCode, $amount);
1064
    }
1065
1066
    /**
1067
     * A helper method for creating a Money object from a float based on the shared currency
1068
     *
1069
     * @param float|string $amount
1070
     * @return Money|null
1071
     */
1072
    private function createMoneyFromFloat($amount = 0.0) : ?Money
0 ignored issues
show
Unused Code introduced by
The method createMoneyFromFloat() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
1073
    {
1074
        return DandomainFoundation\createMoneyFromFloat((string)$this->currencyCode, $amount);
1075
    }
1076
}
1077