Failed Conditions
Pull Request — experimental/sf (#3236)
by Kentaro
49:41 queued 37:58
created

CustomerAddress::setZip01()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
18
/**
19
 * CustomerAddress
20
 *
21
 * @ORM\Table(name="dtb_customer_address")
22
 * @ORM\InheritanceType("SINGLE_TABLE")
23
 * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
24
 * @ORM\HasLifecycleCallbacks()
25
 * @ORM\Entity(repositoryClass="Eccube\Repository\CustomerAddressRepository")
26
 */
27
class CustomerAddress extends AbstractEntity
28
{
29
    /**
30
     * getShippingMultipleDefaultName
31
     *
32
     * @return string
33
     */
34 26
    public function getShippingMultipleDefaultName()
35
    {
36 26
        return $this->getName01().' '.$this->getPref()->getName().' '.$this->getAddr01().' '.$this->getAddr02();
37
    }
38
39
    /**
40
     * Set from customer.
41
     *
42
     * @param \Eccube\Entity\Customer $Customer
43
     *
44
     * @return \Eccube\Entity\CustomerAddress
45
     */
46 26 View Code Duplication
    public function setFromCustomer(Customer $Customer)
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...
47
    {
48
        $this
49 26
            ->setCustomer($Customer)
50 26
            ->setName01($Customer->getName01())
51 26
            ->setName02($Customer->getName02())
52 26
            ->setKana01($Customer->getKana01())
53 26
            ->setKana02($Customer->getKana02())
54 26
            ->setCompanyName($Customer->getCompanyName())
55 26
            ->setTel01($Customer->getTel01())
56 26
            ->setTel02($Customer->getTel02())
57 26
            ->setTel03($Customer->getTel03())
58 26
            ->setFax01($Customer->getFax01())
59 26
            ->setFax02($Customer->getFax02())
60 26
            ->setFax03($Customer->getFax03())
61 26
            ->setZip01($Customer->getZip01())
62 26
            ->setZip02($Customer->getZip02())
63 26
            ->setZipCode($Customer->getZip01().$Customer->getZip02())
64 26
            ->setPref($Customer->getPref())
65 26
            ->setAddr01($Customer->getAddr01())
66 26
            ->setAddr02($Customer->getAddr02());
67
68 26
        return $this;
69
    }
70
71
    /**
72
     * Set from Shipping.
73
     *
74
     * @param \Eccube\Entity\Shipping $Shipping
75
     *
76
     * @return \Eccube\Entity\CustomerAddress
77
     */
78 View Code Duplication
    public function setFromShipping(Shipping $Shipping)
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...
79
    {
80
        $this
81
            ->setName01($Shipping->getName01())
82
            ->setName02($Shipping->getName02())
83
            ->setKana01($Shipping->getKana01())
84
            ->setKana02($Shipping->getKana02())
85
            ->setCompanyName($Shipping->getCompanyName())
86
            ->setTel01($Shipping->getTel01())
87
            ->setTel02($Shipping->getTel02())
88
            ->setTel03($Shipping->getTel03())
89
            ->setFax01($Shipping->getFax01())
90
            ->setFax02($Shipping->getFax02())
91
            ->setFax03($Shipping->getFax03())
92
            ->setZip01($Shipping->getZip01())
93
            ->setZip02($Shipping->getZip02())
94
            ->setZipCode($Shipping->getZip01().$Shipping->getZip02())
95
            ->setPref($Shipping->getPref())
96
            ->setAddr01($Shipping->getAddr01())
97
            ->setAddr02($Shipping->getAddr02());
98
99
        return $this;
100
    }
101
102
    /**
103
     * @var int
104
     *
105
     * @ORM\Column(name="id", type="integer", options={"unsigned":true})
106
     * @ORM\Id
107
     * @ORM\GeneratedValue(strategy="IDENTITY")
108
     */
109
    private $id;
110
111
    /**
112
     * @var string|null
113
     *
114
     * @ORM\Column(name="name01", type="string", length=255, nullable=true)
115
     */
116
    private $name01;
117
118
    /**
119
     * @var string|null
120
     *
121
     * @ORM\Column(name="name02", type="string", length=255, nullable=true)
122
     */
123
    private $name02;
124
125
    /**
126
     * @var string|null
127
     *
128
     * @ORM\Column(name="kana01", type="string", length=255, nullable=true)
129
     */
130
    private $kana01;
131
132
    /**
133
     * @var string|null
134
     *
135
     * @ORM\Column(name="kana02", type="string", length=255, nullable=true)
136
     */
137
    private $kana02;
138
139
    /**
140
     * @var string|null
141
     *
142
     * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
143
     */
144
    private $company_name;
145
146
    /**
147
     * @var string|null
148
     *
149
     * @ORM\Column(name="zip01", type="string", length=3, nullable=true)
150
     */
151
    private $zip01;
152
153
    /**
154
     * @var string|null
155
     *
156
     * @ORM\Column(name="zip02", type="string", length=4, nullable=true)
157
     */
158
    private $zip02;
159
160
    /**
161
     * @var string|null
162
     *
163
     * @ORM\Column(name="zipcode", type="string", length=7, nullable=true)
164
     */
165
    private $zipcode;
166
167
    /**
168
     * @var string|null
169
     *
170
     * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
171
     */
172
    private $addr01;
173
174
    /**
175
     * @var string|null
176
     *
177
     * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
178
     */
179
    private $addr02;
180
181
    /**
182
     * @var string|null
183
     *
184
     * @ORM\Column(name="tel01", type="string", length=5, nullable=true)
185
     */
186
    private $tel01;
187
188
    /**
189
     * @var string|null
190
     *
191
     * @ORM\Column(name="tel02", type="string", length=4, nullable=true)
192
     */
193
    private $tel02;
194
195
    /**
196
     * @var string|null
197
     *
198
     * @ORM\Column(name="tel03", type="string", length=4, nullable=true)
199
     */
200
    private $tel03;
201
202
    /**
203
     * @var string|null
204
     *
205
     * @ORM\Column(name="fax01", type="string", length=5, nullable=true)
206
     */
207
    private $fax01;
208
209
    /**
210
     * @var string|null
211
     *
212
     * @ORM\Column(name="fax02", type="string", length=4, nullable=true)
213
     */
214
    private $fax02;
215
216
    /**
217
     * @var string|null
218
     *
219
     * @ORM\Column(name="fax03", type="string", length=4, nullable=true)
220
     */
221
    private $fax03;
222
223
    /**
224
     * @var \DateTime
225
     *
226
     * @ORM\Column(name="create_date", type="datetimetz")
227
     */
228
    private $create_date;
229
230
    /**
231
     * @var \DateTime
232
     *
233
     * @ORM\Column(name="update_date", type="datetimetz")
234
     */
235
    private $update_date;
236
237
    /**
238
     * @var \Eccube\Entity\Customer
239
     *
240
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer", inversedBy="CustomerAddresses")
241
     * @ORM\JoinColumns({
242
     *   @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
243
     * })
244
     */
245
    private $Customer;
246
247
    /**
248
     * @var \Eccube\Entity\Master\Country
249
     *
250
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
251
     * @ORM\JoinColumns({
252
     *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
253
     * })
254
     */
255
    private $Country;
256
257
    /**
258
     * @var \Eccube\Entity\Master\Pref
259
     *
260
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
261
     * @ORM\JoinColumns({
262
     *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
263
     * })
264
     */
265
    private $Pref;
266
267
    /**
268
     * Get id.
269
     *
270
     * @return int
271
     */
272 7
    public function getId()
273
    {
274 7
        return $this->id;
275
    }
276
277
    /**
278
     * Set name01.
279
     *
280
     * @param string|null $name01
281
     *
282
     * @return CustomerAddress
283
     */
284 45
    public function setName01($name01 = null)
285
    {
286 45
        $this->name01 = $name01;
287
288 45
        return $this;
289
    }
290
291
    /**
292
     * Get name01.
293
     *
294
     * @return string|null
295
     */
296 43
    public function getName01()
297
    {
298 43
        return $this->name01;
299
    }
300
301
    /**
302
     * Set name02.
303
     *
304
     * @param string|null $name02
305
     *
306
     * @return CustomerAddress
307
     */
308 45
    public function setName02($name02 = null)
309
    {
310 45
        $this->name02 = $name02;
311
312 45
        return $this;
313
    }
314
315
    /**
316
     * Get name02.
317
     *
318
     * @return string|null
319
     */
320 42
    public function getName02()
321
    {
322 42
        return $this->name02;
323
    }
324
325
    /**
326
     * Set kana01.
327
     *
328
     * @param string|null $kana01
329
     *
330
     * @return CustomerAddress
331
     */
332 44
    public function setKana01($kana01 = null)
333
    {
334 44
        $this->kana01 = $kana01;
335
336 44
        return $this;
337
    }
338
339
    /**
340
     * Get kana01.
341
     *
342
     * @return string|null
343
     */
344 42
    public function getKana01()
345
    {
346 42
        return $this->kana01;
347
    }
348
349
    /**
350
     * Set kana02.
351
     *
352
     * @param string|null $kana02
353
     *
354
     * @return CustomerAddress
355
     */
356 44
    public function setKana02($kana02 = null)
357
    {
358 44
        $this->kana02 = $kana02;
359
360 44
        return $this;
361
    }
362
363
    /**
364
     * Get kana02.
365
     *
366
     * @return string|null
367
     */
368 42
    public function getKana02()
369
    {
370 42
        return $this->kana02;
371
    }
372
373
    /**
374
     * Set companyName.
375
     *
376
     * @param string|null $companyName
377
     *
378
     * @return CustomerAddress
379
     */
380 34
    public function setCompanyName($companyName = null)
381
    {
382 34
        $this->company_name = $companyName;
383
384 34
        return $this;
385
    }
386
387
    /**
388
     * Get companyName.
389
     *
390
     * @return string|null
391
     */
392 42
    public function getCompanyName()
393
    {
394 42
        return $this->company_name;
395
    }
396
397
    /**
398
     * Set zip01.
399
     *
400
     * @param string|null $zip01
401
     *
402
     * @return CustomerAddress
403
     */
404 45
    public function setZip01($zip01 = null)
405
    {
406 45
        $this->zip01 = $zip01;
407
408 45
        return $this;
409
    }
410
411
    /**
412
     * Get zip01.
413
     *
414
     * @return string|null
415
     */
416 42
    public function getZip01()
417
    {
418 42
        return $this->zip01;
419
    }
420
421
    /**
422
     * Set zip02.
423
     *
424
     * @param string|null $zip02
425
     *
426
     * @return CustomerAddress
427
     */
428 45
    public function setZip02($zip02 = null)
429
    {
430 45
        $this->zip02 = $zip02;
431
432 45
        return $this;
433
    }
434
435
    /**
436
     * Get zip02.
437
     *
438
     * @return string|null
439
     */
440 42
    public function getZip02()
441
    {
442 42
        return $this->zip02;
443
    }
444
445
    /**
446
     * Set zipcode.
447
     *
448
     * @param string|null $zipcode
449
     *
450
     * @return CustomerAddress
451
     */
452 33
    public function setZipcode($zipcode = null)
453
    {
454 33
        $this->zipcode = $zipcode;
455
456 33
        return $this;
457
    }
458
459
    /**
460
     * Get zipcode.
461
     *
462
     * @return string|null
463
     */
464
    public function getZipcode()
465
    {
466
        return $this->zipcode;
467
    }
468
469
    /**
470
     * Set addr01.
471
     *
472
     * @param string|null $addr01
473
     *
474
     * @return CustomerAddress
475
     */
476 44
    public function setAddr01($addr01 = null)
477
    {
478 44
        $this->addr01 = $addr01;
479
480 44
        return $this;
481
    }
482
483
    /**
484
     * Get addr01.
485
     *
486
     * @return string|null
487
     */
488 43
    public function getAddr01()
489
    {
490 43
        return $this->addr01;
491
    }
492
493
    /**
494
     * Set addr02.
495
     *
496
     * @param string|null $addr02
497
     *
498
     * @return CustomerAddress
499
     */
500 44
    public function setAddr02($addr02 = null)
501
    {
502 44
        $this->addr02 = $addr02;
503
504 44
        return $this;
505
    }
506
507
    /**
508
     * Get addr02.
509
     *
510
     * @return string|null
511
     */
512 43
    public function getAddr02()
513
    {
514 43
        return $this->addr02;
515
    }
516
517
    /**
518
     * Set tel01.
519
     *
520
     * @param string|null $tel01
521
     *
522
     * @return CustomerAddress
523
     */
524 43
    public function setTel01($tel01 = null)
525
    {
526 43
        $this->tel01 = $tel01;
527
528 43
        return $this;
529
    }
530
531
    /**
532
     * Get tel01.
533
     *
534
     * @return string|null
535
     */
536 42
    public function getTel01()
537
    {
538 42
        return $this->tel01;
539
    }
540
541
    /**
542
     * Set tel02.
543
     *
544
     * @param string|null $tel02
545
     *
546
     * @return CustomerAddress
547
     */
548 43
    public function setTel02($tel02 = null)
549
    {
550 43
        $this->tel02 = $tel02;
551
552 43
        return $this;
553
    }
554
555
    /**
556
     * Get tel02.
557
     *
558
     * @return string|null
559
     */
560 42
    public function getTel02()
561
    {
562 42
        return $this->tel02;
563
    }
564
565
    /**
566
     * Set tel03.
567
     *
568
     * @param string|null $tel03
569
     *
570
     * @return CustomerAddress
571
     */
572 43
    public function setTel03($tel03 = null)
573
    {
574 43
        $this->tel03 = $tel03;
575
576 43
        return $this;
577
    }
578
579
    /**
580
     * Get tel03.
581
     *
582
     * @return string|null
583
     */
584 42
    public function getTel03()
585
    {
586 42
        return $this->tel03;
587
    }
588
589
    /**
590
     * Set fax01.
591
     *
592
     * @param string|null $fax01
593
     *
594
     * @return CustomerAddress
595
     */
596 45
    public function setFax01($fax01 = null)
597
    {
598 45
        $this->fax01 = $fax01;
599
600 45
        return $this;
601
    }
602
603
    /**
604
     * Get fax01.
605
     *
606
     * @return string|null
607
     */
608 42
    public function getFax01()
609
    {
610 42
        return $this->fax01;
611
    }
612
613
    /**
614
     * Set fax02.
615
     *
616
     * @param string|null $fax02
617
     *
618
     * @return CustomerAddress
619
     */
620 45
    public function setFax02($fax02 = null)
621
    {
622 45
        $this->fax02 = $fax02;
623
624 45
        return $this;
625
    }
626
627
    /**
628
     * Get fax02.
629
     *
630
     * @return string|null
631
     */
632 42
    public function getFax02()
633
    {
634 42
        return $this->fax02;
635
    }
636
637
    /**
638
     * Set fax03.
639
     *
640
     * @param string|null $fax03
641
     *
642
     * @return CustomerAddress
643
     */
644 45
    public function setFax03($fax03 = null)
645
    {
646 45
        $this->fax03 = $fax03;
647
648 45
        return $this;
649
    }
650
651
    /**
652
     * Get fax03.
653
     *
654
     * @return string|null
655
     */
656 42
    public function getFax03()
657
    {
658 42
        return $this->fax03;
659
    }
660
661
    /**
662
     * Set createDate.
663
     *
664
     * @param \DateTime $createDate
665
     *
666
     * @return CustomerAddress
667
     */
668 17
    public function setCreateDate($createDate)
669
    {
670 17
        $this->create_date = $createDate;
671
672 17
        return $this;
673
    }
674
675
    /**
676
     * Get createDate.
677
     *
678
     * @return \DateTime
679
     */
680
    public function getCreateDate()
681
    {
682
        return $this->create_date;
683
    }
684
685
    /**
686
     * Set updateDate.
687
     *
688
     * @param \DateTime $updateDate
689
     *
690
     * @return CustomerAddress
691
     */
692 17
    public function setUpdateDate($updateDate)
693
    {
694 17
        $this->update_date = $updateDate;
695
696 17
        return $this;
697
    }
698
699
    /**
700
     * Get updateDate.
701
     *
702
     * @return \DateTime
703
     */
704
    public function getUpdateDate()
705
    {
706
        return $this->update_date;
707
    }
708
709
    /**
710
     * Set customer.
711
     *
712
     * @param \Eccube\Entity\Customer|null $customer
713
     *
714
     * @return CustomerAddress
715
     */
716 37
    public function setCustomer(\Eccube\Entity\Customer $customer = null)
717
    {
718 37
        $this->Customer = $customer;
719
720 37
        return $this;
721
    }
722
723
    /**
724
     * Get customer.
725
     *
726
     * @return \Eccube\Entity\Customer|null
727
     */
728 2
    public function getCustomer()
729
    {
730 2
        return $this->Customer;
731
    }
732
733
    /**
734
     * Set country.
735
     *
736
     * @param \Eccube\Entity\Master\Country|null $country
737
     *
738
     * @return CustomerAddress
739
     */
740
    public function setCountry(\Eccube\Entity\Master\Country $country = null)
741
    {
742
        $this->Country = $country;
743
744
        return $this;
745
    }
746
747
    /**
748
     * Get country.
749
     *
750
     * @return \Eccube\Entity\Master\Country|null
751
     */
752
    public function getCountry()
753
    {
754
        return $this->Country;
755
    }
756
757
    /**
758
     * Set pref.
759
     *
760
     * @param \Eccube\Entity\Master\Pref|null $pref
761
     *
762
     * @return CustomerAddress
763
     */
764 44
    public function setPref(\Eccube\Entity\Master\Pref $pref = null)
765
    {
766 44
        $this->Pref = $pref;
767
768 44
        return $this;
769
    }
770
771
    /**
772
     * Get pref.
773
     *
774
     * @return \Eccube\Entity\Master\Pref|null
775
     */
776 43
    public function getPref()
777
    {
778 43
        return $this->Pref;
779
    }
780
}
781