Failed Conditions
Pull Request — experimental/sf (#3236)
by Kentaro
132:46 queued 125:39
created

Shipping   F

Complexity

Total Complexity 67

Size/Duplication

Total Lines 1019
Duplicated Lines 1.57 %

Coupling/Cohesion

Components 2
Dependencies 6

Test Coverage

Coverage 82.8%

Importance

Changes 0
Metric Value
dl 16
loc 1019
ccs 154
cts 186
cp 0.828
rs 2.564
c 0
b 0
f 0
wmc 67
lcom 2
cbo 6

64 Methods

Rating   Name   Duplication   Size   Complexity  
A getShippingMultipleDefaultName() 0 4 1
A __construct() 0 4 1
A setFromCustomerAddress() 16 16 1
A clearCustomerAddress() 0 16 1
A getId() 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 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 setShippingDeliveryName() 0 6 1
A getShippingDeliveryName() 0 4 1
A setShippingDeliveryTime() 0 6 1
A getShippingDeliveryTime() 0 4 1
A setShippingDeliveryDate() 0 6 1
A getShippingDeliveryDate() 0 4 1
A setShippingDeliveryFee() 0 6 1
A getShippingDeliveryFee() 0 4 1
A setShippingDate() 0 6 1
A getShippingDate() 0 4 1
A setSortNo() 0 6 1
A getSortNo() 0 4 1
A setCreateDate() 0 6 1
A getCreateDate() 0 4 1
A setUpdateDate() 0 6 1
A getUpdateDate() 0 4 1
A addOrderItem() 0 6 1
A removeOrderItem() 0 4 1
A getOrderItems() 0 4 1
A getProductOrderItems() 0 6 1
A setCountry() 0 6 1
A getCountry() 0 4 1
A setPref() 0 6 1
A getPref() 0 4 1
A setDelivery() 0 6 1
A getDelivery() 0 4 1
A getProductClassOfTemp() 0 4 1
A setProductClassOfTemp() 0 6 1
A getOrders() 0 19 4
A setTrackingNumber() 0 6 1
A getTrackingNumber() 0 4 1
A setNote() 0 6 1
A getNote() 0 4 1
A setShippingStatus() 0 6 1
A getShippingStatus() 0 4 1
A setTimeId() 0 6 1
A getTimeId() 0 4 1
A setFeeId() 0 6 1
A getFeeId() 0 4 1
A setCreator() 0 6 1
A getCreator() 0 4 1

How to fix   Duplicated Code    Complexity   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

Complex Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like Shipping 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 Shipping, 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\ORM\Mapping as ORM;
17
use Eccube\Entity\Master\ShippingStatus;
18
use Eccube\Service\Calculator\OrderItemCollection;
19
use Eccube\Service\PurchaseFlow\ItemCollection;
20
21
/**
22
 * Shipping
23
 *
24
 * @ORM\Table(name="dtb_shipping")
25
 * @ORM\InheritanceType("SINGLE_TABLE")
26
 * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
27
 * @ORM\HasLifecycleCallbacks()
28
 * @ORM\Entity(repositoryClass="Eccube\Repository\ShippingRepository")
29
 */
30
class Shipping extends \Eccube\Entity\AbstractEntity
31
{
32 26
    public function getShippingMultipleDefaultName()
33
    {
34 26
        return $this->getName01().' '.$this->getPref()->getName().' '.$this->getAddr01().' '.$this->getAddr02();
35
    }
36
37
    /**
38
     * @var int
39
     *
40
     * @ORM\Column(name="id", type="integer", options={"unsigned":true})
41
     * @ORM\Id
42
     * @ORM\GeneratedValue(strategy="IDENTITY")
43
     */
44
    private $id;
45
46
    /**
47
     * @var string
48
     *
49
     * @ORM\Column(name="name01", type="string", length=255)
50
     */
51
    private $name01;
52
53
    /**
54
     * @var string
55
     *
56
     * @ORM\Column(name="name02", type="string", length=255)
57
     */
58
    private $name02;
59
60
    /**
61
     * @var string
62
     *
63
     * @ORM\Column(name="kana01", type="string", length=255)
64
     */
65
    private $kana01;
66
67
    /**
68
     * @var string
69
     *
70
     * @ORM\Column(name="kana02", type="string", length=255)
71
     */
72
    private $kana02;
73
74
    /**
75
     * @var string|null
76
     *
77
     * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
78
     */
79
    private $company_name;
80
81
    /**
82
     * @var string|null
83
     *
84
     * @ORM\Column(name="phone_number", type="string", length=14, nullable=true)
85
     */
86
    private $phone_number;
87
88
    /**
89
     * @var string|null
90
     *
91
     * @ORM\Column(name="postal_code", type="string", length=8, nullable=true)
92
     */
93
    private $postal_code;
94
95
    /**
96
     * @var string|null
97
     *
98
     * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
99
     */
100
    private $addr01;
101
102
    /**
103
     * @var string|null
104
     *
105
     * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
106
     */
107
    private $addr02;
108
109
    /**
110
     * @var string|null
111
     *
112
     * @ORM\Column(name="delivery_name", type="string", length=255, nullable=true)
113
     */
114
    private $shipping_delivery_name;
115
116
    /**
117
     * @var int
118
     *
119
     * @ORM\Column(name="time_id", type="integer", options={"unsigned":true}, nullable=true)
120
     */
121
    private $time_id;
122
123
    /**
124
     * @var int
125
     *
126
     * @ORM\Column(name="fee_id", type="integer", options={"unsigned":true}, nullable=true)
127
     */
128
    private $fee_id;
129
130
    /**
131
     * @var string|null
132
     *
133
     * @ORM\Column(name="delivery_time", type="string", length=255, nullable=true)
134
     */
135
    private $shipping_delivery_time;
136
137
    /**
138
     * お届け予定日/お届け希望日
139
     *
140
     * @var \DateTime|null
141
     *
142
     * @ORM\Column(name="delivery_date", type="datetimetz", nullable=true)
143
     */
144
    private $shipping_delivery_date;
145
146
    /**
147
     * @var string|null
148
     *
149
     * @ORM\Column(name="delivery_fee", type="decimal", precision=12, scale=2, nullable=true, options={"unsigned":true,"default":0})
150
     */
151
    private $shipping_delivery_fee = 0;
152
153
    /**
154
     * 出荷日
155
     *
156
     * @var \DateTime|null
157
     *
158
     * @ORM\Column(name="shipping_date", type="datetimetz", nullable=true)
159
     */
160
    private $shipping_date;
161
162
    /**
163
     * @var string
164
     *
165
     * @ORM\Column(name="tracking_number", type="string", length=255, nullable=true)
166
     */
167
    private $tracking_number;
168
169
    /**
170
     * @var string
171
     *
172
     * @ORM\Column(name="note", type="string", length=4000, nullable=true)
173
     */
174
    private $note;
175
176
    /**
177
     * @var int|null
178
     *
179
     * @ORM\Column(name="sort_no", type="smallint", nullable=true, options={"unsigned":true})
180
     */
181
    private $sort_no;
182
183
    /**
184
     * @var \DateTime
185
     *
186
     * @ORM\Column(name="create_date", type="datetimetz")
187
     */
188
    private $create_date;
189
190
    /**
191
     * @var \DateTime
192
     *
193
     * @ORM\Column(name="update_date", type="datetimetz")
194
     */
195
    private $update_date;
196
197
    /**
198
     * @var \Doctrine\Common\Collections\Collection
199
     *
200
     * @ORM\OneToMany(targetEntity="Eccube\Entity\OrderItem", mappedBy="Shipping", cascade={"persist"})
201
     */
202
    private $OrderItems;
203
204
    /**
205
     * @var \Eccube\Entity\Master\Country
206
     *
207
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
208
     * @ORM\JoinColumns({
209
     *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
210
     * })
211
     */
212
    private $Country;
213
214
    /**
215
     * @var \Eccube\Entity\Master\Pref
216
     *
217
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
218
     * @ORM\JoinColumns({
219
     *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
220
     * })
221
     */
222
    private $Pref;
223
224
    /**
225
     * @var \Eccube\Entity\Delivery
226
     *
227
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Delivery")
228
     * @ORM\JoinColumns({
229
     *   @ORM\JoinColumn(name="delivery_id", referencedColumnName="id")
230
     * })
231
     */
232
    private $Delivery;
233
234
    /**
235
     * @var \Doctrine\Common\Collections\Collection
236
     */
237
    private $Orders;
0 ignored issues
show
Unused Code introduced by
The property $Orders is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
238
239
    /**
240
     * @var \Eccube\Entity\ProductClass
241
     */
242
    private $ProductClassOfTemp;
243
244
    /**
245
     * @var \Eccube\Entity\Master\ShippingStatus
246
     *
247
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\ShippingStatus")
248
     * @ORM\JoinColumns({
249
     *   @ORM\JoinColumn(name="shipping_status_id", referencedColumnName="id")
250
     * })
251
     */
252
    private $ShippingStatus;
253
254
    /**
255
     * @var \Eccube\Entity\Member
256
     *
257
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
258
     * @ORM\JoinColumns({
259
     *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
260
     * })
261
     */
262
    private $Creator;
263
264
    /**
265
     * Constructor
266
     */
267 195
    public function __construct()
268
    {
269 195
        $this->OrderItems = new \Doctrine\Common\Collections\ArrayCollection();
270
    }
271
272
    /**
273
     * CustomerAddress から個人情報を設定.
274
     *
275
     * @param \Eccube\Entity\CustomerAddress $CustomerAddress
276
     *
277
     * @return \Eccube\Entity\Shipping
278
     */
279 25 View Code Duplication
    public function setFromCustomerAddress(CustomerAddress $CustomerAddress)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
280
    {
281
        $this
282 25
            ->setName01($CustomerAddress->getName01())
283 25
            ->setName02($CustomerAddress->getName02())
284 25
            ->setKana01($CustomerAddress->getKana01())
285 25
            ->setKana02($CustomerAddress->getKana02())
286 25
            ->setCompanyName($CustomerAddress->getCompanyName())
287 25
            ->setPhoneNumber($CustomerAddress->getPhonenumber())
288 25
            ->setPostalCode($CustomerAddress->getPostalCode())
289 25
            ->setPref($CustomerAddress->getPref())
290 25
            ->setAddr01($CustomerAddress->getAddr01())
291 25
            ->setAddr02($CustomerAddress->getAddr02());
292
293 25
        return $this;
294
    }
295
296
    /**
297
     * 個人情報をクリア.
298
     *
299
     * @return \Eccube\Entity\Shipping
300
     */
301
    public function clearCustomerAddress()
302
    {
303
        $this
304
            ->setName01(null)
305
            ->setName02(null)
306
            ->setKana01(null)
307
            ->setKana02(null)
308
            ->setCompanyName(null)
309
            ->setPhoneNumber(null)
310
            ->setPostalCode(null)
311
            ->setPref(null)
312
            ->setAddr01(null)
313
            ->setAddr02(null);
314
315
        return $this;
316
    }
317
318
    /**
319
     * Get id.
320
     *
321
     * @return int
322
     */
323 79
    public function getId()
324
    {
325 79
        return $this->id;
326
    }
327
328
    /**
329
     * Set name01.
330
     *
331
     * @param string $name01
332
     *
333
     * @return Shipping
334
     */
335 66
    public function setName01($name01)
336
    {
337 66
        $this->name01 = $name01;
338
339 66
        return $this;
340
    }
341
342
    /**
343
     * Get name01.
344
     *
345
     * @return string
346
     */
347 66
    public function getName01()
348
    {
349 66
        return $this->name01;
350
    }
351
352
    /**
353
     * Set name02.
354
     *
355
     * @param string $name02
356
     *
357
     * @return Shipping
358
     */
359 54
    public function setName02($name02)
360
    {
361 54
        $this->name02 = $name02;
362
363 54
        return $this;
364
    }
365
366
    /**
367
     * Get name02.
368
     *
369
     * @return string
370
     */
371 64
    public function getName02()
372
    {
373 64
        return $this->name02;
374
    }
375
376
    /**
377
     * Set kana01.
378
     *
379
     * @param string $kana01
380
     *
381
     * @return Shipping
382
     */
383 54
    public function setKana01($kana01)
384
    {
385 54
        $this->kana01 = $kana01;
386
387 54
        return $this;
388
    }
389
390
    /**
391
     * Get kana01.
392
     *
393
     * @return string
394
     */
395 61
    public function getKana01()
396
    {
397 61
        return $this->kana01;
398
    }
399
400
    /**
401
     * Set kana02.
402
     *
403
     * @param string $kana02
404
     *
405
     * @return Shipping
406
     */
407 52
    public function setKana02($kana02)
408
    {
409 52
        $this->kana02 = $kana02;
410
411 52
        return $this;
412
    }
413
414
    /**
415
     * Get kana02.
416
     *
417
     * @return string
418
     */
419 60
    public function getKana02()
420
    {
421 60
        return $this->kana02;
422
    }
423
424
    /**
425
     * Set companyName.
426
     *
427
     * @param string|null $companyName
428
     *
429
     * @return Shipping
430
     */
431 52
    public function setCompanyName($companyName = null)
432
    {
433 52
        $this->company_name = $companyName;
434
435 52
        return $this;
436
    }
437
438
    /**
439
     * Get companyName.
440
     *
441
     * @return string|null
442
     */
443 21
    public function getCompanyName()
444
    {
445 21
        return $this->company_name;
446
    }
447
448
    /**
449
     * Set phone_number.
450
     *
451
     * @param string|null $phone_number
452
     *
453
     * @return Shipping
454
     */
455 52
    public function setPhoneNumber($phone_number = null)
456
    {
457 52
        $this->phone_number = $phone_number;
458
459 52
        return $this;
460
    }
461
462
    /**
463
     * Get phone_number.
464
     *
465
     * @return string|null
466
     */
467 64
    public function getPhoneNumber()
468
    {
469 64
        return $this->phone_number;
470
    }
471
472
    /**
473
     * Set postal_code.
474
     *
475
     * @param string|null $postal_code
476
     *
477
     * @return Shipping
478
     */
479 52
    public function setPostalCode($postal_code = null)
480
    {
481 52
        $this->postal_code = $postal_code;
482
483 52
        return $this;
484
    }
485
486
    /**
487
     * Get postal_code.
488
     *
489
     * @return string|null
490
     */
491 64
    public function getPostalCode()
492
    {
493 64
        return $this->postal_code;
494
    }
495
496
    /**
497
     * Set addr01.
498
     *
499
     * @param string|null $addr01
500
     *
501
     * @return Shipping
502
     */
503 52
    public function setAddr01($addr01 = null)
504
    {
505 52
        $this->addr01 = $addr01;
506
507 52
        return $this;
508
    }
509
510
    /**
511
     * Get addr01.
512
     *
513
     * @return string|null
514
     */
515 64
    public function getAddr01()
516
    {
517 64
        return $this->addr01;
518
    }
519
520
    /**
521
     * Set addr02.
522
     *
523
     * @param string|null $addr02
524
     *
525
     * @return Shipping
526
     */
527 52
    public function setAddr02($addr02 = null)
528
    {
529 52
        $this->addr02 = $addr02;
530
531 52
        return $this;
532
    }
533
534
    /**
535
     * Get addr02.
536
     *
537
     * @return string|null
538
     */
539 64
    public function getAddr02()
540
    {
541 64
        return $this->addr02;
542
    }
543
544
    /**
545
     * Set shippingDeliveryName.
546
     *
547
     * @param string|null $shippingDeliveryName
548
     *
549
     * @return Shipping
550
     */
551 183
    public function setShippingDeliveryName($shippingDeliveryName = null)
552
    {
553 183
        $this->shipping_delivery_name = $shippingDeliveryName;
554
555 183
        return $this;
556
    }
557
558
    /**
559
     * Get shippingDeliveryName.
560
     *
561
     * @return string|null
562
     */
563 5
    public function getShippingDeliveryName()
564
    {
565 5
        return $this->shipping_delivery_name;
566
    }
567
568
    /**
569
     * Set shippingDeliveryTime.
570
     *
571
     * @param string|null $shippingDeliveryTime
572
     *
573
     * @return Shipping
574
     */
575 20
    public function setShippingDeliveryTime($shippingDeliveryTime = null)
576
    {
577 20
        $this->shipping_delivery_time = $shippingDeliveryTime;
578
579 20
        return $this;
580
    }
581
582
    /**
583
     * Get shippingDeliveryTime.
584
     *
585
     * @return string|null
586
     */
587 16
    public function getShippingDeliveryTime()
588
    {
589 16
        return $this->shipping_delivery_time;
590
    }
591
592
    /**
593
     * Set shippingDeliveryDate.
594
     *
595
     * @param \DateTime|null $shippingDeliveryDate
596
     *
597
     * @return Shipping
598
     */
599 5
    public function setShippingDeliveryDate($shippingDeliveryDate = null)
600
    {
601 5
        $this->shipping_delivery_date = $shippingDeliveryDate;
602
603 5
        return $this;
604
    }
605
606
    /**
607
     * Get shippingDeliveryDate.
608
     *
609
     * @return \DateTime|null
610
     */
611 21
    public function getShippingDeliveryDate()
612
    {
613 21
        return $this->shipping_delivery_date;
614
    }
615
616
    /**
617
     * Set shippingDeliveryFee.
618
     *
619
     * @param string|null $shippingDeliveryFee
620
     *
621
     * @return Shipping
622
     */
623 182
    public function setShippingDeliveryFee($shippingDeliveryFee = null)
624
    {
625 182
        $this->shipping_delivery_fee = $shippingDeliveryFee;
626
627 182
        return $this;
628
    }
629
630
    /**
631
     * Get shippingDeliveryFee.
632
     *
633
     * @return string|null
634
     */
635 182
    public function getShippingDeliveryFee()
636
    {
637 182
        return $this->shipping_delivery_fee;
638
    }
639
640
    /**
641
     * Set shippingDate.
642
     *
643
     * @param \DateTime|null $shippingDate
644
     *
645
     * @return Shipping
646
     */
647 8
    public function setShippingDate($shippingDate = null)
648
    {
649 8
        $this->shipping_date = $shippingDate;
650
651 8
        return $this;
652
    }
653
654
    /**
655
     * Get shippingDate.
656
     *
657
     * @return \DateTime|null
658
     */
659 10
    public function getShippingDate()
660
    {
661 10
        return $this->shipping_date;
662
    }
663
664
    /**
665
     * Set sortNo.
666
     *
667
     * @param int|null $sortNo
668
     *
669
     * @return Shipping
670
     */
671
    public function setSortNo($sortNo = null)
672
    {
673
        $this->sort_no = $sortNo;
674
675
        return $this;
676
    }
677
678
    /**
679
     * Get sortNo.
680
     *
681
     * @return int|null
682
     */
683
    public function getSortNo()
684
    {
685
        return $this->sort_no;
686
    }
687
688
    /**
689
     * Set createDate.
690
     *
691
     * @param \DateTime $createDate
692
     *
693
     * @return Shipping
694
     */
695 183
    public function setCreateDate($createDate)
696
    {
697 183
        $this->create_date = $createDate;
698
699 183
        return $this;
700
    }
701
702
    /**
703
     * Get createDate.
704
     *
705
     * @return \DateTime
706
     */
707
    public function getCreateDate()
708
    {
709
        return $this->create_date;
710
    }
711
712
    /**
713
     * Set updateDate.
714
     *
715
     * @param \DateTime $updateDate
716
     *
717
     * @return Shipping
718
     */
719 183
    public function setUpdateDate($updateDate)
720
    {
721 183
        $this->update_date = $updateDate;
722
723 183
        return $this;
724
    }
725
726
    /**
727
     * Get updateDate.
728
     *
729
     * @return \DateTime
730
     */
731 5
    public function getUpdateDate()
732
    {
733 5
        return $this->update_date;
734
    }
735
736
    /**
737
     * Add orderItem.
738
     *
739
     * @param \Eccube\Entity\OrderItem $OrderItem
740
     *
741
     * @return Shipping
742
     */
743 193
    public function addOrderItem(\Eccube\Entity\OrderItem $OrderItem)
744
    {
745 193
        $this->OrderItems[] = $OrderItem;
746
747 193
        return $this;
748
    }
749
750
    /**
751
     * Remove orderItem.
752
     *
753
     * @param \Eccube\Entity\OrderItem $OrderItem
754
     *
755
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
756
     */
757 25
    public function removeOrderItem(\Eccube\Entity\OrderItem $OrderItem)
758
    {
759 25
        return $this->OrderItems->removeElement($OrderItem);
760
    }
761
762
    /**
763
     * Get orderItems.
764
     *
765
     * @return \Doctrine\Common\Collections\Collection
766
     */
767 79
    public function getOrderItems()
768
    {
769 79
        return (new ItemCollection($this->OrderItems))->sort();
770
    }
771
772
    /**
773
     * 商品の受注明細を取得
774
     *
775
     * @return OrderItem[]
776
     */
777 60
    public function getProductOrderItems()
778
    {
779 60
        $sio = new OrderItemCollection($this->OrderItems->toArray());
780
781 60
        return $sio->getProductClasses()->toArray();
782
    }
783
784
    /**
785
     * Set country.
786
     *
787
     * @param \Eccube\Entity\Master\Country|null $country
788
     *
789
     * @return Shipping
790
     */
791
    public function setCountry(\Eccube\Entity\Master\Country $country = null)
792
    {
793
        $this->Country = $country;
794
795
        return $this;
796
    }
797
798
    /**
799
     * Get country.
800
     *
801
     * @return \Eccube\Entity\Master\Country|null
802
     */
803
    public function getCountry()
804
    {
805
        return $this->Country;
806
    }
807
808
    /**
809
     * Set pref.
810
     *
811
     * @param \Eccube\Entity\Master\Pref|null $pref
812
     *
813
     * @return Shipping
814
     */
815 183
    public function setPref(\Eccube\Entity\Master\Pref $pref = null)
816
    {
817 183
        $this->Pref = $pref;
818
819 183
        return $this;
820
    }
821
822
    /**
823
     * Get pref.
824
     *
825
     * @return \Eccube\Entity\Master\Pref|null
826
     */
827 71
    public function getPref()
828
    {
829 71
        return $this->Pref;
830
    }
831
832
    /**
833
     * Set delivery.
834
     *
835
     * @param \Eccube\Entity\Delivery|null $delivery
836
     *
837
     * @return Shipping
838
     */
839 183
    public function setDelivery(\Eccube\Entity\Delivery $delivery = null)
840
    {
841 183
        $this->Delivery = $delivery;
842
843 183
        return $this;
844
    }
845
846
    /**
847
     * Get delivery.
848
     *
849
     * @return \Eccube\Entity\Delivery|null
850
     */
851 59
    public function getDelivery()
852
    {
853 59
        return $this->Delivery;
854
    }
855
856
    /**
857
     * Product class of shipment item (temp)
858
     *
859
     * @return \Eccube\Entity\ProductClass
860
     */
861 26
    public function getProductClassOfTemp()
862
    {
863 26
        return $this->ProductClassOfTemp;
864
    }
865
866
    /**
867
     * Product class of shipment item (temp)
868
     *
869
     * @param \Eccube\Entity\ProductClass $ProductClassOfTemp
870
     *
871
     * @return $this
872
     */
873 26
    public function setProductClassOfTemp(\Eccube\Entity\ProductClass $ProductClassOfTemp)
874
    {
875 26
        $this->ProductClassOfTemp = $ProductClassOfTemp;
876
877 26
        return $this;
878
    }
879
880
    /**
881
     * Get orders.
882
     *
883
     * @return \Doctrine\Common\Collections\Collection
884
     */
885 13
    public function getOrders()
886
    {
887 13
        $Orders = [];
888 13
        foreach ($this->getOrderItems() as $OrderItem) {
889 12
            $Order = $OrderItem->getOrder();
890 12
            if (is_object($Order)) {
891 12
                $name = $Order->getName01(); // XXX lazy loading
0 ignored issues
show
Unused Code introduced by
$name is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
892 12
                $Orders[$Order->getId()] = $Order;
893
            }
894
        }
895 13
        $Result = new \Doctrine\Common\Collections\ArrayCollection();
896 13
        foreach ($Orders as $Order) {
897 12
            $Result->add($Order);
898
        }
899
900 13
        return $Result;
901
        // XXX 以下のロジックだと何故か空の Collection になってしまう場合がある
902
        // return new \Doctrine\Common\Collections\ArrayCollection(array_values($Orders));
903
    }
904
905
    /**
906
     * Set trackingNumber
907
     *
908
     * @param string $trackingNumber
909
     *
910
     * @return Shipping
911
     */
912
    public function setTrackingNumber($trackingNumber)
913
    {
914
        $this->tracking_number = $trackingNumber;
915
916
        return $this;
917
    }
918
919
    /**
920
     * Get trackingNumber
921
     *
922
     * @return string
923
     */
924 11
    public function getTrackingNumber()
925
    {
926 11
        return $this->tracking_number;
927
    }
928
929
    /**
930
     * Set note.
931
     *
932
     * @param string|null $note
933
     *
934
     * @return Shipping
935
     */
936
    public function setNote($note = null)
937
    {
938
        $this->note = $note;
939
940
        return $this;
941
    }
942
943
    /**
944
     * Get note.
945
     *
946
     * @return string|null
947
     */
948 7
    public function getNote()
949
    {
950 7
        return $this->note;
951
    }
952
953
    /**
954
     * Set ShippingStatus.
955
     *
956
     * @param ShippingStatus $ShippingStatus
957
     *
958
     * @return $this
959
     */
960 183
    public function setShippingStatus(ShippingStatus $ShippingStatus)
961
    {
962 183
        $this->ShippingStatus = $ShippingStatus;
963
964 183
        return $this;
965
    }
966
967
    /**
968
     * Get ShippingStatus
969
     *
970
     * @return ShippingStatus
971
     */
972 11
    public function getShippingStatus()
973
    {
974 11
        return $this->ShippingStatus;
975
    }
976
977
    /**
978
     * Set timeId
979
     *
980
     * @param integer $timeId
981
     *
982
     * @return Shipping
983
     */
984 20
    public function setTimeId($timeId)
985
    {
986 20
        $this->time_id = $timeId;
987
988 20
        return $this;
989
    }
990
991
    /**
992
     * Get timeId
993
     *
994
     * @return integer
995
     */
996 6
    public function getTimeId()
997
    {
998 6
        return $this->time_id;
999
    }
1000
1001
    /**
1002
     * Set feeId
1003
     *
1004
     * @param integer $feeId
1005
     *
1006
     * @return Shipping
1007
     */
1008 182
    public function setFeeId($feeId)
1009
    {
1010 182
        $this->fee_id = $feeId;
1011
1012 182
        return $this;
1013
    }
1014
1015
    /**
1016
     * Get feeId
1017
     *
1018
     * @return integer
1019
     */
1020
    public function getFeeId()
1021
    {
1022
        return $this->fee_id;
1023
    }
1024
1025
    /**
1026
     * Set creator.
1027
     *
1028
     * @param \Eccube\Entity\Member|null $creator
1029
     *
1030
     * @return Shipping
1031
     */
1032 7
    public function setCreator(\Eccube\Entity\Member $creator = null)
1033
    {
1034 7
        $this->Creator = $creator;
1035
1036 7
        return $this;
1037
    }
1038
1039
    /**
1040
     * Get creator.
1041
     *
1042
     * @return \Eccube\Entity\Member|null
1043
     */
1044 5
    public function getCreator()
1045
    {
1046 5
        return $this->Creator;
1047
    }
1048
}
1049