Code Duplication    Length = 11-11 lines in 2 locations

sdk/ECPay.Logistics.Integration.php 2 locations

@@ 420-430 (lines=11) @@
417
            $this->ValidateString('ReceiverName', $this->PostParams['ReceiverName'], 10);
418
            $this->ValidatePhoneNumber('ReceiverPhone', $this->PostParams['ReceiverPhone'], true);
419
            $this->ValidateCellphoneNumber('ReceiverCellPhone', $this->PostParams['ReceiverCellPhone'], true);
420
            if ($this->PostParams['LogisticsType'] == LogisticsType::HOME) {
421
                // 物流類型(LogisticsType)為宅配(Home)時,收件人電話(ReceiverPhone)或收件人手機(ReceiverCellPhone)不可為空
422
                if (empty($this->PostParams['ReceiverPhone']) and empty($this->PostParams['ReceiverCellPhone'])) {
423
                    throw new Exception('ReceiverPhone or ReceiverCellPhone is required when LogisticsType is Home.');
424
                }
425
            } else {
426
                // 物流子類型(LogisticsSubType)為統一超商(UNIMART)、全家(FAMILY)、萊爾富(HILIFE)、統一超商交貨便(UNIMARTC2C)、全家超商店到店(FAMILYC2C)、萊爾富富店到店(HILIFEC2C)時,收件人手機(ReceiverCellPhone)不可為空
427
                if (empty($this->PostParams['ReceiverCellPhone'])) {
428
                    throw new Exception('ReceiverCellPhone is required.');
429
                }
430
            }
431
432
            if ($this->PostParams['LogisticsSubType'] == LogisticsSubType::ECAN and $this->PostParams['Temperature'] !== Temperature::ROOM) {
433
                // 物流子類型為宅配通(ECAN)時,溫層(Temperature)只能用常溫(ROOM)
@@ 611-621 (lines=11) @@
608
            $this->ValidateString('ReceiverName', $this->PostParams['ReceiverName'], 10);
609
            $this->ValidatePhoneNumber('ReceiverPhone', $this->PostParams['ReceiverPhone'], true);
610
            $this->ValidateCellphoneNumber('ReceiverCellPhone', $this->PostParams['ReceiverCellPhone'], true);
611
            if ($this->PostParams['LogisticsType'] == LogisticsType::HOME) {
612
                // 物流類型(LogisticsType)為宅配(Home)時,收件人電話(ReceiverPhone)或收件人手機(ReceiverCellPhone)不可為空
613
                if (empty($this->PostParams['ReceiverPhone']) and empty($this->PostParams['ReceiverCellPhone'])) {
614
                    throw new Exception('ReceiverPhone or ReceiverCellPhone is required when LogisticsType is Home.');
615
                }
616
            } else {
617
                // 物流子類型(LogisticsSubType)為統一超商(UNIMART)、全家(FAMILY)、萊爾富(HILIFE)、統一超商交貨便(UNIMARTC2C)、全家超商店到店(FAMILYC2C)、萊爾富富店到店(HILIFEC2C)時,收件人手機(ReceiverCellPhone)不可為空
618
                if (empty($this->PostParams['ReceiverCellPhone'])) {
619
                    throw new Exception('ReceiverCellPhone is required.');
620
                }
621
            }
622
623
            if ($this->PostParams['LogisticsSubType'] == LogisticsSubType::ECAN and $this->PostParams['Temperature'] !== Temperature::ROOM) {
624
                // 物流子類型為宅配通(ECAN)時,溫層(Temperature)只能用常溫(ROOM)