Failed Conditions
Pull Request — experimental/sf (#3236)
by Kentaro
142:37 queued 134:37
created

Order   F

Complexity

Total Complexity 111

Size/Duplication

Total Lines 1593
Duplicated Lines 0 %

Coupling/Cohesion

Components 6
Dependencies 11

Test Coverage

Coverage 87.67%

Importance

Changes 0
Metric Value
dl 0
loc 1593
ccs 256
cts 292
cp 0.8767
rs 0.8
c 0
b 0
f 0
wmc 111
lcom 6
cbo 11

100 Methods

Rating   Name   Duplication   Size   Complexity  
A isMultiple() 0 17 5
A findShipping() 0 10 3
A getSaleTypes() 0 13 3
A getTotalPrice() 0 7 1
A __construct() 0 16 1
A getId() 0 4 1
A setPreOrderId() 0 6 1
A getPreOrderId() 0 4 1
A setOrderNo() 0 6 1
A getOrderNo() 0 4 1
A setMessage() 0 6 1
A getMessage() 0 4 1
A setName01() 0 6 1
A getName01() 0 4 1
A setName02() 0 6 1
A getName02() 0 4 1
A setKana01() 0 6 1
A getKana01() 0 4 1
A setKana02() 0 6 1
A getKana02() 0 4 1
A setCompanyName() 0 6 1
A getCompanyName() 0 4 1
A setEmail() 0 6 1
A getEmail() 0 4 1
A setPhoneNumber() 0 6 1
A getPhoneNumber() 0 4 1
A setPostalCode() 0 6 1
A getPostalCode() 0 4 1
A setAddr01() 0 6 1
A getAddr01() 0 4 1
A setAddr02() 0 6 1
A getAddr02() 0 4 1
A setBirth() 0 6 1
A getBirth() 0 4 1
A setSubtotal() 0 6 1
A getSubtotal() 0 4 1
A setDiscount() 0 6 1
A getDiscount() 0 4 1
A setDeliveryFeeTotal() 0 6 1
A getDeliveryFeeTotal() 0 4 1
A setCharge() 0 6 1
A getCharge() 0 4 1
A setTax() 0 6 1
A getTax() 0 4 1
A setTotal() 0 6 1
A getTotal() 0 4 1
A setPaymentTotal() 0 6 1
A getPaymentTotal() 0 4 1
A setPaymentMethod() 0 6 1
A getPaymentMethod() 0 4 1
A setNote() 0 6 1
A getNote() 0 4 1
A setCreateDate() 0 6 1
A getCreateDate() 0 4 1
A setUpdateDate() 0 6 1
A getUpdateDate() 0 4 1
A setOrderDate() 0 6 1
A getOrderDate() 0 4 1
A setPaymentDate() 0 6 1
A getPaymentDate() 0 4 1
A getCurrencyCode() 0 4 1
A setCurrencyCode() 0 6 1
A getCompleteMessage() 0 4 1
A setCompleteMessage() 0 6 1
A appendCompleteMessage() 0 6 1
A getCompleteMailMessage() 0 4 1
A setCompleteMailMessage() 0 6 1
A appendCompleteMailMessage() 0 6 1
A getProductOrderItems() 0 6 1
A getMergedProductOrderItems() 0 31 3
A addOrderItem() 0 6 1
A removeOrderItem() 0 4 1
A getOrderItems() 0 4 1
A getItems() 0 4 1
A addShipping() 0 6 1
A removeShipping() 0 4 1
A getShippings() 0 7 1
A addMailHistory() 0 6 1
A removeMailHistory() 0 4 1
A getMailHistories() 0 4 1
A setCustomer() 0 6 1
A getCustomer() 0 4 1
A setCountry() 0 6 1
A getCountry() 0 4 1
A setPref() 0 6 1
A getPref() 0 4 1
A setSex() 0 6 1
A getSex() 0 4 1
A setJob() 0 6 1
A getJob() 0 4 1
A setPayment() 0 6 1
A getPayment() 0 4 1
A setDeviceType() 0 6 1
A getDeviceType() 0 4 1
A setCustomerOrderStatus() 0 6 1
A getCustomerOrderStatus() 0 4 1
A setOrderStatus() 0 6 1
A getOrderStatus() 0 4 1
A addItem() 0 4 1
A getQuantity() 0 9 2

How to fix   Complexity   

Complex Class

Complex classes like Order often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Order, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Eccube\Entity;
15
16
use Doctrine\Common\Collections\Criteria;
17
use Doctrine\ORM\Mapping as ORM;
18
use Eccube\Service\Calculator\OrderItemCollection;
19
use Eccube\Service\PurchaseFlow\ItemCollection;
20
21
/**
22
 * Order
23
 *
24
 * @ORM\Table(name="dtb_order", indexes={
25
 *     @ORM\Index(name="dtb_order_pre_order_id_idx", columns={"pre_order_id"}),
26
 *     @ORM\Index(name="dtb_order_email_idx", columns={"email"}),
27
 *     @ORM\Index(name="dtb_order_order_date_idx", columns={"order_date"}),
28
 *     @ORM\Index(name="dtb_order_payment_date_idx", columns={"payment_date"}),
29
 *     @ORM\Index(name="dtb_order_update_date_idx", columns={"update_date"}),
30
 *     @ORM\Index(name="dtb_order_order_no_idx", columns={"order_no"})
31
 *  })
32
 * @ORM\InheritanceType("SINGLE_TABLE")
33
 * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
34
 * @ORM\HasLifecycleCallbacks()
35
 * @ORM\Entity(repositoryClass="Eccube\Repository\OrderRepository")
36
 */
37
class Order extends \Eccube\Entity\AbstractEntity implements PurchaseInterface, ItemHolderInterface
38
{
39
    use NameTrait, PointTrait;
40
41
    /**
42
     * 複数配送かどうかの判定を行う.
43
     *
44
     * @return boolean
45
     */
46 64
    public function isMultiple()
47
    {
48 64
        $Shippings = [];
49
        // クエリビルダ使用時に絞り込まれる場合があるため,
50
        // getShippingsではなくOrderItem経由でShippingを取得する.
51 64
        foreach ($this->getOrderItems() as $OrderItem) {
52 61
            if ($Shipping = $OrderItem->getShipping()) {
53 61
                $id = $Shipping->getId();
54 61
                if (isset($Shippings[$id])) {
55 61
                    continue;
56
                }
57 61
                $Shippings[$id] = $Shipping;
58
            }
59
        }
60
61 64
        return count($Shippings) > 1 ? true : false;
62
    }
63
64
    /**
65
     * 対象となるお届け先情報を取得
66
     *
67
     * @param integer $shippingId
68
     *
69
     * @return \Eccube\Entity\Shipping|null
70
     */
71
    public function findShipping($shippingId)
72
    {
73
        foreach ($this->getShippings() as $Shipping) {
74
            if ($Shipping->getId() == $shippingId) {
75
                return $Shipping;
76
            }
77
        }
78
79
        return null;
80
    }
81
82
    /**
83
     * この注文の保持する販売種別を取得します.
84
     *
85
     * @return \Eccube\Entity\Master\SaleType[] 一意な販売種別の配列
86
     */
87 1
    public function getSaleTypes()
88
    {
89 1
        $saleTypes = [];
90 1
        foreach ($this->getOrderItems() as $OrderItem) {
91
            /* @var $ProductClass \Eccube\Entity\ProductClass */
92 1
            $ProductClass = $OrderItem->getProductClass();
93 1
            if ($ProductClass) {
94 1
                $saleTypes[] = $ProductClass->getSaleType();
95
            }
96
        }
97
98 1
        return array_unique($saleTypes);
99
    }
100
101
    /**
102
     * 合計金額を計算
103
     *
104
     * @return string
105
     *
106
     * @deprecated
107
     */
108 1
    public function getTotalPrice()
109
    {
110 1
        @trigger_error('The '.__METHOD__.' method is deprecated.', E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
111
112 1
        return $this->getSubtotal() + $this->getCharge() + $this->getDeliveryFeeTotal() - $this->getDiscount();
113
//        return $this->getSubtotal() + $this->getCharge() - $this->getDiscount();
114
    }
115
116
    /**
117
     * @var integer
118
     *
119
     * @ORM\Column(name="id", type="integer", options={"unsigned":true})
120
     * @ORM\Id
121
     * @ORM\GeneratedValue(strategy="IDENTITY")
122
     */
123
    private $id;
124
125
    /**
126
     * @var string|null
127
     *
128
     * @ORM\Column(name="pre_order_id", type="string", length=255, nullable=true)
129
     */
130
    private $pre_order_id;
131
132
    /**
133
     * @var string|null
134
     *
135
     * @ORM\Column(name="order_no", type="string", length=255, nullable=true)
136
     */
137
    private $order_no;
138
139
    /**
140
     * @var string|null
141
     *
142
     * @ORM\Column(name="message", type="string", length=4000, nullable=true)
143
     */
144
    private $message;
145
146
    /**
147
     * @var string|null
148
     *
149
     * @ORM\Column(name="name01", type="string", length=255, nullable=true)
150
     */
151
    private $name01;
152
153
    /**
154
     * @var string|null
155
     *
156
     * @ORM\Column(name="name02", type="string", length=255, nullable=true)
157
     */
158
    private $name02;
159
160
    /**
161
     * @var string|null
162
     *
163
     * @ORM\Column(name="kana01", type="string", length=255, nullable=true)
164
     */
165
    private $kana01;
166
167
    /**
168
     * @var string|null
169
     *
170
     * @ORM\Column(name="kana02", type="string", length=255, nullable=true)
171
     */
172
    private $kana02;
173
174
    /**
175
     * @var string|null
176
     *
177
     * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
178
     */
179
    private $company_name;
180
181
    /**
182
     * @var string|null
183
     *
184
     * @ORM\Column(name="email", type="string", length=255, nullable=true)
185
     */
186
    private $email;
187
188
    /**
189
     * @var string|null
190
     *
191
     * @ORM\Column(name="phone_number", type="string", length=14, nullable=true)
192
     */
193
    private $phone_number;
194
195
    /**
196
     * @var string|null
197
     *
198
     * @ORM\Column(name="postal_code", type="string", length=8, nullable=true)
199
     */
200
    private $postal_code;
201
202
    /**
203
     * @var string|null
204
     *
205
     * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
206
     */
207
    private $addr01;
208
209
    /**
210
     * @var string|null
211
     *
212
     * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
213
     */
214
    private $addr02;
215
216
    /**
217
     * @var \DateTime|null
218
     *
219
     * @ORM\Column(name="birth", type="datetimetz", nullable=true)
220
     */
221
    private $birth;
222
223
    /**
224
     * @var string
225
     *
226
     * @ORM\Column(name="subtotal", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
227
     */
228
    private $subtotal = 0;
229
230
    /**
231
     * @var string
232
     *
233
     * @ORM\Column(name="discount", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
234
     */
235
    private $discount = 0;
236
237
    /**
238
     * @var string
239
     *
240
     * @ORM\Column(name="delivery_fee_total", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
241
     */
242
    private $delivery_fee_total = 0;
243
244
    /**
245
     * @var string
246
     *
247
     * @ORM\Column(name="charge", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
248
     */
249
    private $charge = 0;
250
251
    /**
252
     * @var string
253
     *
254
     * @ORM\Column(name="tax", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
255
     */
256
    private $tax = 0;
257
258
    /**
259
     * @var string
260
     *
261
     * @ORM\Column(name="total", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
262
     */
263
    private $total = 0;
264
265
    /**
266
     * @var string
267
     *
268
     * @ORM\Column(name="payment_total", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
269
     */
270
    private $payment_total = 0;
271
272
    /**
273
     * @var string|null
274
     *
275
     * @ORM\Column(name="payment_method", type="string", length=255, nullable=true)
276
     */
277
    private $payment_method;
278
279
    /**
280
     * @var string|null
281
     *
282
     * @ORM\Column(name="note", type="string", length=4000, nullable=true)
283
     */
284
    private $note;
285
286
    /**
287
     * @var \DateTime
288
     *
289
     * @ORM\Column(name="create_date", type="datetimetz")
290
     */
291
    private $create_date;
292
293
    /**
294
     * @var \DateTime
295
     *
296
     * @ORM\Column(name="update_date", type="datetimetz")
297
     */
298
    private $update_date;
299
300
    /**
301
     * @var \DateTime|null
302
     *
303
     * @ORM\Column(name="order_date", type="datetimetz", nullable=true)
304
     */
305
    private $order_date;
306
307
    /**
308
     * @var \DateTime|null
309
     *
310
     * @ORM\Column(name="payment_date", type="datetimetz", nullable=true)
311
     */
312
    private $payment_date;
313
314
    /**
315
     * @var string|null
316
     *
317
     * @ORM\Column(name="currency_code", type="string", nullable=true)
318
     */
319
    private $currency_code;
320
321
    /**
322
     * 注文完了画面に表示するメッセージ
323
     *
324
     * プラグインから注文完了時にメッセージを表示したい場合, このフィールドにセットすることで, 注文完了画面で表示されます。
325
     * 複数のプラグインから利用されるため, appendCompleteMesssage()で追加してください.
326
     * 表示する際にHTMLは利用可能です。
327
     *
328
     * @var string|null
329
     *
330
     * @ORM\Column(name="complete_message", type="text", nullable=true)
331
     */
332
    private $complete_message;
333
334
    /**
335
     * 注文完了メールに表示するメッセージ
336
     *
337
     * プラグインから注文完了メールにメッセージを表示したい場合, このフィールドにセットすることで, 注文完了メールで表示されます。
338
     * 複数のプラグインから利用されるため, appendCompleteMailMesssage()で追加してください.
339
     *
340
     * @var string|null
341
     *
342
     * @ORM\Column(name="complete_mail_message", type="text", nullable=true)
343
     */
344
    private $complete_mail_message;
345
346
    /**
347
     * @var \Doctrine\Common\Collections\Collection|OrderItem[]
348
     *
349
     * @ORM\OneToMany(targetEntity="Eccube\Entity\OrderItem", mappedBy="Order", cascade={"persist","remove"})
350
     */
351
    private $OrderItems;
352
353
    /**
354
     * @var \Doctrine\Common\Collections\Collection|Shipping[]
355
     *
356
     * @ORM\OneToMany(targetEntity="Eccube\Entity\Shipping", mappedBy="Order", cascade={"persist","remove"})
357
     */
358
    private $Shippings;
359
360
    /**
361
     * @var \Doctrine\Common\Collections\Collection
362
     *
363
     * @ORM\OneToMany(targetEntity="Eccube\Entity\MailHistory", mappedBy="Order", cascade={"remove"})
364
     * @ORM\OrderBy({
365
     *     "send_date"="DESC"
366
     * })
367
     */
368
    private $MailHistories;
369
370
    /**
371
     * @var \Eccube\Entity\Customer
372
     *
373
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer", inversedBy="Orders")
374
     * @ORM\JoinColumns({
375
     *   @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
376
     * })
377
     */
378
    private $Customer;
379
380
    /**
381
     * @var \Eccube\Entity\Master\Country
382
     *
383
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
384
     * @ORM\JoinColumns({
385
     *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
386
     * })
387
     */
388
    private $Country;
389
390
    /**
391
     * @var \Eccube\Entity\Master\Pref
392
     *
393
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
394
     * @ORM\JoinColumns({
395
     *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
396
     * })
397
     */
398
    private $Pref;
399
400
    /**
401
     * @var \Eccube\Entity\Master\Sex
402
     *
403
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Sex")
404
     * @ORM\JoinColumns({
405
     *   @ORM\JoinColumn(name="sex_id", referencedColumnName="id")
406
     * })
407
     */
408
    private $Sex;
409
410
    /**
411
     * @var \Eccube\Entity\Master\Job
412
     *
413
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Job")
414
     * @ORM\JoinColumns({
415
     *   @ORM\JoinColumn(name="job_id", referencedColumnName="id")
416
     * })
417
     */
418
    private $Job;
419
420
    /**
421
     * @var \Eccube\Entity\Payment
422
     *
423
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Payment")
424
     * @ORM\JoinColumns({
425
     *   @ORM\JoinColumn(name="payment_id", referencedColumnName="id")
426
     * })
427
     */
428
    private $Payment;
429
430
    /**
431
     * @var \Eccube\Entity\Master\DeviceType
432
     *
433
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\DeviceType")
434
     * @ORM\JoinColumns({
435
     *   @ORM\JoinColumn(name="device_type_id", referencedColumnName="id")
436
     * })
437
     */
438
    private $DeviceType;
439
440
    /**
441
     * @var \Eccube\Entity\Master\CustomerOrderStatus
442
     *
443
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\CustomerOrderStatus")
444
     * @ORM\JoinColumns({
445
     *   @ORM\JoinColumn(name="order_status_id", referencedColumnName="id")
446
     * })
447
     */
448
    private $CustomerOrderStatus;
449
450
    /**
451
     * @var \Eccube\Entity\Master\OrderStatus
452
     *
453
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\OrderStatus")
454
     * @ORM\JoinColumns({
455
     *   @ORM\JoinColumn(name="order_status_id", referencedColumnName="id")
456
     * })
457
     */
458
    private $OrderStatus;
459
460
    /**
461
     * Constructor
462
     */
463 313
    public function __construct(\Eccube\Entity\Master\OrderStatus $orderStatus = null)
464
    {
465 313
        $this->setDiscount(0)
466 313
            ->setSubtotal(0)
467 313
            ->setTotal(0)
468 313
            ->setPaymentTotal(0)
469 313
            ->setCharge(0)
470 313
            ->setTax(0)
471 313
            ->setDeliveryFeeTotal(0)
472 313
            ->setOrderStatus($orderStatus)
473
        ;
474
475 313
        $this->OrderItems = new \Doctrine\Common\Collections\ArrayCollection();
476 313
        $this->Shippings = new \Doctrine\Common\Collections\ArrayCollection();
477 313
        $this->MailHistories = new \Doctrine\Common\Collections\ArrayCollection();
478
    }
479
480
    /**
481
     * Get id.
482
     *
483
     * @return int
484
     */
485 107
    public function getId()
486
    {
487 107
        return $this->id;
488
    }
489
490
    /**
491
     * Set preOrderId.
492
     *
493
     * @param string|null $preOrderId
494
     *
495
     * @return Order
496
     */
497 206
    public function setPreOrderId($preOrderId = null)
498
    {
499 206
        $this->pre_order_id = $preOrderId;
500
501 206
        return $this;
502
    }
503
504
    /**
505
     * Get preOrderId.
506
     *
507
     * @return string|null
508
     */
509 53
    public function getPreOrderId()
510
    {
511 53
        return $this->pre_order_id;
512
    }
513
514
    /**
515
     * Set orderNo
516
     *
517
     * @param string|null $orderNo
518
     *
519
     * @return Order
520
     */
521 228
    public function setOrderNo($orderNo = null)
522
    {
523 228
        $this->order_no = $orderNo;
524
525 228
        return $this;
526
    }
527
528
    /**
529
     * Get orderNo
530
     *
531
     * @return string|null
532
     */
533 104
    public function getOrderNo()
534
    {
535 104
        return $this->order_no;
536
    }
537
538
    /**
539
     * Set message.
540
     *
541
     * @param string|null $message
542
     *
543
     * @return Order
544
     */
545 182
    public function setMessage($message = null)
546
    {
547 182
        $this->message = $message;
548
549 182
        return $this;
550
    }
551
552
    /**
553
     * Get message.
554
     *
555
     * @return string|null
556
     */
557 80
    public function getMessage()
558
    {
559 80
        return $this->message;
560
    }
561
562
    /**
563
     * Set name01.
564
     *
565
     * @param string|null $name01
566
     *
567
     * @return Order
568
     */
569 18
    public function setName01($name01 = null)
570
    {
571 18
        $this->name01 = $name01;
572
573 18
        return $this;
574
    }
575
576
    /**
577
     * Get name01.
578
     *
579
     * @return string|null
580
     */
581 80
    public function getName01()
582
    {
583 80
        return $this->name01;
584
    }
585
586
    /**
587
     * Set name02.
588
     *
589
     * @param string|null $name02
590
     *
591
     * @return Order
592
     */
593 18
    public function setName02($name02 = null)
594
    {
595 18
        $this->name02 = $name02;
596
597 18
        return $this;
598
    }
599
600
    /**
601
     * Get name02.
602
     *
603
     * @return string|null
604
     */
605 80
    public function getName02()
606
    {
607 80
        return $this->name02;
608
    }
609
610
    /**
611
     * Set kana01.
612
     *
613
     * @param string|null $kana01
614
     *
615
     * @return Order
616
     */
617 19
    public function setKana01($kana01 = null)
618
    {
619 19
        $this->kana01 = $kana01;
620
621 19
        return $this;
622
    }
623
624
    /**
625
     * Get kana01.
626
     *
627
     * @return string|null
628
     */
629 74
    public function getKana01()
630
    {
631 74
        return $this->kana01;
632
    }
633
634
    /**
635
     * Set kana02.
636
     *
637
     * @param string|null $kana02
638
     *
639
     * @return Order
640
     */
641 19
    public function setKana02($kana02 = null)
642
    {
643 19
        $this->kana02 = $kana02;
644
645 19
        return $this;
646
    }
647
648
    /**
649
     * Get kana02.
650
     *
651
     * @return string|null
652
     */
653 74
    public function getKana02()
654
    {
655 74
        return $this->kana02;
656
    }
657
658
    /**
659
     * Set companyName.
660
     *
661
     * @param string|null $companyName
662
     *
663
     * @return Order
664
     */
665 16
    public function setCompanyName($companyName = null)
666
    {
667 16
        $this->company_name = $companyName;
668
669 16
        return $this;
670
    }
671
672
    /**
673
     * Get companyName.
674
     *
675
     * @return string|null
676
     */
677 71
    public function getCompanyName()
678
    {
679 71
        return $this->company_name;
680
    }
681
682
    /**
683
     * Set email.
684
     *
685
     * @param string|null $email
686
     *
687
     * @return Order
688
     */
689 16
    public function setEmail($email = null)
690
    {
691 16
        $this->email = $email;
692
693 16
        return $this;
694
    }
695
696
    /**
697
     * Get email.
698
     *
699
     * @return string|null
700
     */
701 75
    public function getEmail()
702
    {
703 75
        return $this->email;
704
    }
705
706
    /**
707
     * Set phone_number.
708
     *
709
     * @param string|null $phone_number
710
     *
711
     * @return Order
712
     */
713 17
    public function setPhoneNumber($phone_number = null)
714
    {
715 17
        $this->phone_number = $phone_number;
716
717 17
        return $this;
718
    }
719
720
    /**
721
     * Get phone_number.
722
     *
723
     * @return string|null
724
     */
725 70
    public function getPhoneNumber()
726
    {
727 70
        return $this->phone_number;
728
    }
729
730
    /**
731
     * Set postal_code.
732
     *
733
     * @param string|null $postal_code
734
     *
735
     * @return Order
736
     */
737 16
    public function setPostalCode($postal_code = null)
738
    {
739 16
        $this->postal_code = $postal_code;
740
741 16
        return $this;
742
    }
743
744
    /**
745
     * Get postal_code.
746
     *
747
     * @return string|null
748
     */
749 74
    public function getPostalCode()
750
    {
751 74
        return $this->postal_code;
752
    }
753
754
    /**
755
     * Set addr01.
756
     *
757
     * @param string|null $addr01
758
     *
759
     * @return Order
760
     */
761 16
    public function setAddr01($addr01 = null)
762
    {
763 16
        $this->addr01 = $addr01;
764
765 16
        return $this;
766
    }
767
768
    /**
769
     * Get addr01.
770
     *
771
     * @return string|null
772
     */
773 74
    public function getAddr01()
774
    {
775 74
        return $this->addr01;
776
    }
777
778
    /**
779
     * Set addr02.
780
     *
781
     * @param string|null $addr02
782
     *
783
     * @return Order
784
     */
785 16
    public function setAddr02($addr02 = null)
786
    {
787 16
        $this->addr02 = $addr02;
788
789 16
        return $this;
790
    }
791
792
    /**
793
     * Get addr02.
794
     *
795
     * @return string|null
796
     */
797 74
    public function getAddr02()
798
    {
799 74
        return $this->addr02;
800
    }
801
802
    /**
803
     * Set birth.
804
     *
805
     * @param \DateTime|null $birth
806
     *
807
     * @return Order
808
     */
809 5
    public function setBirth($birth = null)
810
    {
811 5
        $this->birth = $birth;
812
813 5
        return $this;
814
    }
815
816
    /**
817
     * Get birth.
818
     *
819
     * @return \DateTime|null
820
     */
821 3
    public function getBirth()
822
    {
823 3
        return $this->birth;
824
    }
825
826
    /**
827
     * Set subtotal.
828
     *
829
     * @param string $subtotal
830
     *
831
     * @return Order
832
     */
833 313
    public function setSubtotal($subtotal)
834
    {
835 313
        $this->subtotal = $subtotal;
836
837 313
        return $this;
838
    }
839
840
    /**
841
     * Get subtotal.
842
     *
843
     * @return string
844
     */
845 57
    public function getSubtotal()
846
    {
847 57
        return $this->subtotal;
848
    }
849
850
    /**
851
     * Set discount.
852
     *
853
     * @param string $discount
854
     *
855
     * @return Order
856
     */
857 313
    public function setDiscount($discount)
858
    {
859 313
        $this->discount = $discount;
860
861 313
        return $this;
862
    }
863
864
    /**
865
     * Get discount.
866
     *
867
     * @return string
868
     */
869 213
    public function getDiscount()
870
    {
871 213
        return $this->discount;
872
    }
873
874
    /**
875
     * Set deliveryFeeTotal.
876
     *
877
     * @param string $deliveryFeeTotal
878
     *
879
     * @return Order
880
     */
881 313
    public function setDeliveryFeeTotal($deliveryFeeTotal)
882
    {
883 313
        $this->delivery_fee_total = $deliveryFeeTotal;
884
885 313
        return $this;
886
    }
887
888
    /**
889
     * Get deliveryFeeTotal.
890
     *
891
     * @return string
892
     */
893 72
    public function getDeliveryFeeTotal()
894
    {
895 72
        return $this->delivery_fee_total;
896
    }
897
898
    /**
899
     * Set charge.
900
     *
901
     * @param string $charge
902
     *
903
     * @return Order
904
     */
905 313
    public function setCharge($charge)
906
    {
907 313
        $this->charge = $charge;
908
909 313
        return $this;
910
    }
911
912
    /**
913
     * Get charge.
914
     *
915
     * @return string
916
     */
917 213
    public function getCharge()
918
    {
919 213
        return $this->charge;
920
    }
921
922
    /**
923
     * Set tax.
924
     *
925
     * @param string $tax
926
     *
927
     * @return Order
928
     */
929 313
    public function setTax($tax)
930
    {
931 313
        $this->tax = $tax;
932
933 313
        return $this;
934
    }
935
936
    /**
937
     * Get tax.
938
     *
939
     * @return string
940
     */
941 16
    public function getTax()
942
    {
943 16
        return $this->tax;
944
    }
945
946
    /**
947
     * Set total.
948
     *
949
     * @param string $total
950
     *
951
     * @return Order
952
     */
953 313
    public function setTotal($total)
954
    {
955 313
        $this->total = $total;
956
957 313
        return $this;
958
    }
959
960
    /**
961
     * Get total.
962
     *
963
     * @return string
964
     */
965 221
    public function getTotal()
966
    {
967 221
        return $this->total;
968
    }
969
970
    /**
971
     * Set paymentTotal.
972
     *
973
     * @param string $paymentTotal
974
     *
975
     * @return Order
976
     */
977 313
    public function setPaymentTotal($paymentTotal)
978
    {
979 313
        $this->payment_total = $paymentTotal;
980
981 313
        return $this;
982
    }
983
984
    /**
985
     * Get paymentTotal.
986
     *
987
     * @return string
988
     */
989 24
    public function getPaymentTotal()
990
    {
991 24
        return $this->payment_total;
992
    }
993
994
    /**
995
     * Set paymentMethod.
996
     *
997
     * @param string|null $paymentMethod
998
     *
999
     * @return Order
1000
     */
1001 219
    public function setPaymentMethod($paymentMethod = null)
1002
    {
1003 219
        $this->payment_method = $paymentMethod;
1004
1005 219
        return $this;
1006
    }
1007
1008
    /**
1009
     * Get paymentMethod.
1010
     *
1011
     * @return string|null
1012
     */
1013 19
    public function getPaymentMethod()
1014
    {
1015 19
        return $this->payment_method;
1016
    }
1017
1018
    /**
1019
     * Set note.
1020
     *
1021
     * @param string|null $note
1022
     *
1023
     * @return Order
1024
     */
1025 157
    public function setNote($note = null)
1026
    {
1027 157
        $this->note = $note;
1028
1029 157
        return $this;
1030
    }
1031
1032
    /**
1033
     * Get note.
1034
     *
1035
     * @return string|null
1036
     */
1037 20
    public function getNote()
1038
    {
1039 20
        return $this->note;
1040
    }
1041
1042
    /**
1043
     * Set createDate.
1044
     *
1045
     * @param \DateTime $createDate
1046
     *
1047
     * @return Order
1048
     */
1049 208
    public function setCreateDate($createDate)
1050
    {
1051 208
        $this->create_date = $createDate;
1052
1053 208
        return $this;
1054
    }
1055
1056
    /**
1057
     * Get createDate.
1058
     *
1059
     * @return \DateTime
1060
     */
1061
    public function getCreateDate()
1062
    {
1063
        return $this->create_date;
1064
    }
1065
1066
    /**
1067
     * Set updateDate.
1068
     *
1069
     * @param \DateTime $updateDate
1070
     *
1071
     * @return Order
1072
     */
1073 208
    public function setUpdateDate($updateDate)
1074
    {
1075 208
        $this->update_date = $updateDate;
1076
1077 208
        return $this;
1078
    }
1079
1080
    /**
1081
     * Get updateDate.
1082
     *
1083
     * @return \DateTime
1084
     */
1085 2
    public function getUpdateDate()
1086
    {
1087 2
        return $this->update_date;
1088
    }
1089
1090
    /**
1091
     * Set orderDate.
1092
     *
1093
     * @param \DateTime|null $orderDate
1094
     *
1095
     * @return Order
1096
     */
1097 33
    public function setOrderDate($orderDate = null)
1098
    {
1099 33
        $this->order_date = $orderDate;
1100
1101 33
        return $this;
1102
    }
1103
1104
    /**
1105
     * Get orderDate.
1106
     *
1107
     * @return \DateTime|null
1108
     */
1109 17
    public function getOrderDate()
1110
    {
1111 17
        return $this->order_date;
1112
    }
1113
1114
    /**
1115
     * Set paymentDate.
1116
     *
1117
     * @param \DateTime|null $paymentDate
1118
     *
1119
     * @return Order
1120
     */
1121 5
    public function setPaymentDate($paymentDate = null)
1122
    {
1123 5
        $this->payment_date = $paymentDate;
1124
1125 5
        return $this;
1126
    }
1127
1128
    /**
1129
     * Get paymentDate.
1130
     *
1131
     * @return \DateTime|null
1132
     */
1133 15
    public function getPaymentDate()
1134
    {
1135 15
        return $this->payment_date;
1136
    }
1137
1138
    /**
1139
     * Get currencyCode.
1140
     *
1141
     * @return string
1142
     */
1143
    public function getCurrencyCode()
1144
    {
1145
        return $this->currency_code;
1146
    }
1147
1148
    /**
1149
     * Set currencyCode.
1150
     *
1151
     * @param string|null $currencyCode
1152
     *
1153
     * @return $this
1154
     */
1155 208
    public function setCurrencyCode($currencyCode = null)
1156
    {
1157 208
        $this->currency_code = $currencyCode;
1158
1159 208
        return $this;
1160
    }
1161
1162
    /**
1163
     * @return null|string
1164
     */
1165 1
    public function getCompleteMessage()
1166
    {
1167 1
        return $this->complete_message;
1168
    }
1169
1170
    /**
1171
     * @param null|string $complete_message
1172
     *
1173
     * @return $this
1174
     */
1175
    public function setCompleteMessage($complete_message = null)
1176
    {
1177
        $this->complete_message = $complete_message;
1178
1179
        return $this;
1180
    }
1181
1182
    /**
1183
     * @param null|string $complete_message
1184
     *
1185
     * @return $this
1186
     */
1187
    public function appendCompleteMessage($complete_message = null)
1188
    {
1189
        $this->complete_message .= $complete_message;
1190
1191
        return $this;
1192
    }
1193
1194
    /**
1195
     * @return null|string
1196
     */
1197 11
    public function getCompleteMailMessage()
1198
    {
1199 11
        return $this->complete_mail_message;
1200
    }
1201
1202
    /**
1203
     * @param null|string $complete_mail_message
1204
     *
1205
     * @return
1206
     */
1207
    public function setCompleteMailMessage($complete_mail_message = null)
1208
    {
1209
        $this->complete_mail_message = $complete_mail_message;
1210
1211
        return $this;
1212
    }
1213
1214
    /**
1215
     * @param null|string $complete_mail_message
1216
     *
1217
     * @return
1218
     */
1219
    public function appendCompleteMailMessage($complete_mail_message = null)
1220
    {
1221
        $this->complete_mail_message .= $complete_mail_message;
1222
1223
        return $this;
1224
    }
1225
1226
    /**
1227
     * 商品の受注明細を取得
1228
     *
1229
     * @return OrderItem[]
1230
     */
1231 36
    public function getProductOrderItems()
1232
    {
1233 36
        $sio = new OrderItemCollection($this->OrderItems->toArray());
1234
1235 36
        return array_values($sio->getProductClasses()->toArray());
1236
    }
1237
1238
    /**
1239
     * 同じ規格の商品の個数をまとめた受注明細を取得
1240
     *
1241
     * @return OrderItem[]
1242
     */
1243 1
    public function getMergedProductOrderItems()
1244
    {
1245 1
        $ProductOrderItems = $this->getProductOrderItems();
1246
1247 1
        $orderItemArray = [];
1248
1249
        /** @var OrderItem $ProductOrderItem */
1250 1
        foreach ($ProductOrderItems as $ProductOrderItem) {
1251 1
            $productClassId = $ProductOrderItem->getProductClass()->getId();
1252 1
            if (array_key_exists($productClassId, $orderItemArray)) {
1253
                // 同じ規格の商品がある場合は個数をまとめる
1254
                /** @var ItemInterface $OrderItem */
1255 1
                $OrderItem = $orderItemArray[$productClassId];
1256 1
                $quantity = $OrderItem->getQuantity() + $ProductOrderItem->getQuantity();
1257 1
                $OrderItem->setQuantity($quantity);
1258
            } else {
1259
                // 新規規格の商品は新しく追加する
1260 1
                $OrderItem = new OrderItem();
1261
                $OrderItem
1262 1
                    ->setProduct($ProductOrderItem->getProduct())
1263 1
                    ->setProductName($ProductOrderItem->getProductName())
1264 1
                    ->setClassCategoryName1($ProductOrderItem->getClassCategoryName1())
1265 1
                    ->setClassCategoryName2($ProductOrderItem->getClassCategoryName2())
1266 1
                    ->setPriceIncTax($ProductOrderItem->getPriceIncTax())
1267 1
                    ->setQuantity($ProductOrderItem->getQuantity());
1268 1
                $orderItemArray[$productClassId] = $OrderItem;
1269
            }
1270
        }
1271
1272 1
        return array_values($orderItemArray);
1273
    }
1274
1275
    /**
1276
     * Add orderItem.
1277
     *
1278
     * @param \Eccube\Entity\OrderItem $OrderItem
1279
     *
1280
     * @return Order
1281
     */
1282 239
    public function addOrderItem(\Eccube\Entity\OrderItem $OrderItem)
1283
    {
1284 239
        $this->OrderItems[] = $OrderItem;
1285
1286 239
        return $this;
1287
    }
1288
1289
    /**
1290
     * Remove orderItem.
1291
     *
1292
     * @param \Eccube\Entity\OrderItem $OrderItem
1293
     *
1294
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
1295
     */
1296 28
    public function removeOrderItem(\Eccube\Entity\OrderItem $OrderItem)
1297
    {
1298 28
        return $this->OrderItems->removeElement($OrderItem);
1299
    }
1300
1301
    /**
1302
     * Get orderItems.
1303
     *
1304
     * @return \Doctrine\Common\Collections\Collection
1305
     */
1306 241
    public function getOrderItems()
1307
    {
1308 241
        return $this->OrderItems;
1309
    }
1310
1311
    /**
1312
     * Sorted to getOrderItems()
1313
     *
1314
     * @return ItemCollection
1315
     */
1316 230
    public function getItems()
1317
    {
1318 230
        return (new ItemCollection($this->getOrderItems()))->sort();
1319
    }
1320
1321
    /**
1322
     * Add shipping.
1323
     *
1324
     * @param \Eccube\Entity\Shipping $Shipping
1325
     *
1326
     * @return Shipping
1327
     */
1328 219
    public function addShipping(\Eccube\Entity\Shipping $Shipping)
1329
    {
1330 219
        $this->Shippings[] = $Shipping;
1331
1332 219
        return $this;
1333
    }
1334
1335
    /**
1336
     * Remove shipping.
1337
     *
1338
     * @param \Eccube\Entity\Shipping $Shipping
1339
     *
1340
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
1341
     */
1342 25
    public function removeShipping(\Eccube\Entity\Shipping $Shipping)
1343
    {
1344 25
        return $this->Shippings->removeElement($Shipping);
1345
    }
1346
1347
    /**
1348
     * Get shippings.
1349
     *
1350
     * @return \Doctrine\Common\Collections\Collection|\Eccube\Entity\Shipping[]
1351
     */
1352 130
    public function getShippings()
1353
    {
1354 130
        $criteria = Criteria::create()
1355 130
            ->orderBy(['name01' => Criteria::ASC, 'name02' => Criteria::ASC]);
1356
1357 130
        return $this->Shippings->matching($criteria);
0 ignored issues
show
Bug introduced by
It seems like you code against a concrete implementation and not the interface Doctrine\Common\Collections\Collection as the method matching() does only exist in the following implementations of said interface: Doctrine\Common\Collections\ArrayCollection, Doctrine\ORM\LazyCriteriaCollection, Doctrine\ORM\PersistentCollection, Eccube\Service\Calculator\OrderItemCollection, Eccube\Service\PurchaseFlow\ItemCollection.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
1358
    }
1359
1360
    /**
1361
     * Add mailHistory.
1362
     *
1363
     * @param \Eccube\Entity\MailHistory $mailHistory
1364
     *
1365
     * @return Order
1366
     */
1367
    public function addMailHistory(\Eccube\Entity\MailHistory $mailHistory)
1368
    {
1369
        $this->MailHistories[] = $mailHistory;
1370
1371
        return $this;
1372
    }
1373
1374
    /**
1375
     * Remove mailHistory.
1376
     *
1377
     * @param \Eccube\Entity\MailHistory $mailHistory
1378
     *
1379
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
1380
     */
1381
    public function removeMailHistory(\Eccube\Entity\MailHistory $mailHistory)
1382
    {
1383
        return $this->MailHistories->removeElement($mailHistory);
1384
    }
1385
1386
    /**
1387
     * Get mailHistories.
1388
     *
1389
     * @return \Doctrine\Common\Collections\Collection
1390
     */
1391 1
    public function getMailHistories()
1392
    {
1393 1
        return $this->MailHistories;
1394
    }
1395
1396
    /**
1397
     * Set customer.
1398
     *
1399
     * @param \Eccube\Entity\Customer|null $customer
1400
     *
1401
     * @return Order
1402
     */
1403 203
    public function setCustomer(\Eccube\Entity\Customer $customer = null)
1404
    {
1405 203
        $this->Customer = $customer;
1406
1407 203
        return $this;
1408
    }
1409
1410
    /**
1411
     * Get customer.
1412
     *
1413
     * @return \Eccube\Entity\Customer|null
1414
     */
1415 232
    public function getCustomer()
1416
    {
1417 232
        return $this->Customer;
1418
    }
1419
1420
    /**
1421
     * Set country.
1422
     *
1423
     * @param \Eccube\Entity\Master\Country|null $country
1424
     *
1425
     * @return Order
1426
     */
1427
    public function setCountry(\Eccube\Entity\Master\Country $country = null)
1428
    {
1429
        $this->Country = $country;
1430
1431
        return $this;
1432
    }
1433
1434
    /**
1435
     * Get country.
1436
     *
1437
     * @return \Eccube\Entity\Master\Country|null
1438
     */
1439
    public function getCountry()
1440
    {
1441
        return $this->Country;
1442
    }
1443
1444
    /**
1445
     * Set pref.
1446
     *
1447
     * @param \Eccube\Entity\Master\Pref|null $pref
1448
     *
1449
     * @return Order
1450
     */
1451 168
    public function setPref(\Eccube\Entity\Master\Pref $pref = null)
1452
    {
1453 168
        $this->Pref = $pref;
1454
1455 168
        return $this;
1456
    }
1457
1458
    /**
1459
     * Get pref.
1460
     *
1461
     * @return \Eccube\Entity\Master\Pref|null
1462
     */
1463 74
    public function getPref()
1464
    {
1465 74
        return $this->Pref;
1466
    }
1467
1468
    /**
1469
     * Set sex.
1470
     *
1471
     * @param \Eccube\Entity\Master\Sex|null $sex
1472
     *
1473
     * @return Order
1474
     */
1475 6
    public function setSex(\Eccube\Entity\Master\Sex $sex = null)
1476
    {
1477 6
        $this->Sex = $sex;
1478
1479 6
        return $this;
1480
    }
1481
1482
    /**
1483
     * Get sex.
1484
     *
1485
     * @return \Eccube\Entity\Master\Sex|null
1486
     */
1487 3
    public function getSex()
1488
    {
1489 3
        return $this->Sex;
1490
    }
1491
1492
    /**
1493
     * Set job.
1494
     *
1495
     * @param \Eccube\Entity\Master\Job|null $job
1496
     *
1497
     * @return Order
1498
     */
1499 5
    public function setJob(\Eccube\Entity\Master\Job $job = null)
1500
    {
1501 5
        $this->Job = $job;
1502
1503 5
        return $this;
1504
    }
1505
1506
    /**
1507
     * Get job.
1508
     *
1509
     * @return \Eccube\Entity\Master\Job|null
1510
     */
1511 3
    public function getJob()
1512
    {
1513 3
        return $this->Job;
1514
    }
1515
1516
    /**
1517
     * Set payment.
1518
     *
1519
     * @param \Eccube\Entity\Payment|null $payment
1520
     *
1521
     * @return Order
1522
     */
1523 219
    public function setPayment(\Eccube\Entity\Payment $payment = null)
1524
    {
1525 219
        $this->Payment = $payment;
1526
1527 219
        return $this;
1528
    }
1529
1530
    /**
1531
     * Get payment.
1532
     *
1533
     * @return \Eccube\Entity\Payment|null
1534
     */
1535 219
    public function getPayment()
1536
    {
1537 219
        return $this->Payment;
1538
    }
1539
1540
    /**
1541
     * Set deviceType.
1542
     *
1543
     * @param \Eccube\Entity\Master\DeviceType|null $deviceType
1544
     *
1545
     * @return Order
1546
     */
1547 54
    public function setDeviceType(\Eccube\Entity\Master\DeviceType $deviceType = null)
1548
    {
1549 54
        $this->DeviceType = $deviceType;
1550
1551 54
        return $this;
1552
    }
1553
1554
    /**
1555
     * Get deviceType.
1556
     *
1557
     * @return \Eccube\Entity\Master\DeviceType|null
1558
     */
1559 2
    public function getDeviceType()
1560
    {
1561 2
        return $this->DeviceType;
1562
    }
1563
1564
    /**
1565
     * Set customerOrderStatus.
1566
     *
1567
     * @param \Eccube\Entity\Master\CustomerOrderStatus|null $customerOrderStatus
1568
     *
1569
     * @return Order
1570
     */
1571
    public function setCustomerOrderStatus(\Eccube\Entity\Master\CustomerOrderStatus $customerOrderStatus = null)
1572
    {
1573
        $this->CustomerOrderStatus = $customerOrderStatus;
1574
1575
        return $this;
1576
    }
1577
1578
    /**
1579
     * Get customerOrderStatus.
1580
     *
1581
     * @return \Eccube\Entity\Master\CustomerOrderStatus|null
1582
     */
1583
    public function getCustomerOrderStatus()
1584
    {
1585
        return $this->CustomerOrderStatus;
1586
    }
1587
1588
    /**
1589
     * Set orderStatus.
1590
     *
1591
     * @param \Eccube\Entity\Master\OrderStatus|null $orderStatus
1592
     *
1593
     * @return Order
1594
     */
1595 313
    public function setOrderStatus(\Eccube\Entity\Master\OrderStatus $orderStatus = null)
1596
    {
1597 313
        $this->OrderStatus = $orderStatus;
1598
1599 313
        return $this;
1600
    }
1601
1602
    /**
1603
     * Get orderStatus.
1604
     *
1605
     * @return \Eccube\Entity\Master\OrderStatus|null
1606
     */
1607 130
    public function getOrderStatus()
1608
    {
1609 130
        return $this->OrderStatus;
1610
    }
1611
1612
    /**
1613
     * @param ItemInterface $item
1614
     */
1615 56
    public function addItem(ItemInterface $item)
1616
    {
1617 56
        $this->OrderItems->add($item);
1618
    }
1619
1620 1
    public function getQuantity()
1621
    {
1622 1
        $quantity = 0;
1623 1
        foreach ($this->getItems() as $item) {
1624 1
            $quantity += $item->getQuantity();
1625
        }
1626
1627 1
        return $quantity;
1628
    }
1629
}
1630