Code Duplication    Length = 11-11 lines in 2 locations

sdk/ECPay.Logistics.Integration.php 2 locations

@@ 405-415 (lines=11) @@
402
            $this->ValidateString('SenderName', $this->PostParams['SenderName'], 10);
403
            $this->ValidatePhoneNumber('SenderPhone', $this->PostParams['SenderPhone'], true);
404
            $this->ValidateCellphoneNumber('SenderCellPhone', $this->PostParams['SenderCellPhone'], true);
405
            if ($this->PostParams['LogisticsType'] == LogisticsType::HOME) {
406
                // 物流類型(LogisticsType)為宅配(Home)時,寄件人電話(SenderPhone)或寄件人手機(SenderCellPhone)不可為空
407
                if (empty($this->PostParams['SenderPhone']) and empty($this->PostParams['SenderCellPhone'])) {
408
                    throw new Exception('SenderPhone or SenderCellPhone is required when LogisticsType is Home.');
409
                }
410
            } elseif ($this->PostParams['LogisticsSubType'] == LogisticsSubType::HILIFE_C2C or $this->PostParams['LogisticsSubType'] == LogisticsSubType::UNIMART_C2C) {
411
                // 物流子類型(LogisticsSubType)為統一超商交貨便(UNIMARTC2C)、萊爾富店到店(HILIFEC2C)時,寄件人手機(SenderCellPhone)不可為空
412
                if (empty($this->PostParams['SenderCellPhone'])) {
413
                    throw new Exception('SenderCellPhone is required when LogisticsSubType is UNIMARTC2C or HILIFEC2C.');
414
                }
415
            }
416
417
            $this->ValidateString('ReceiverName', $this->PostParams['ReceiverName'], 10);
418
            $this->ValidatePhoneNumber('ReceiverPhone', $this->PostParams['ReceiverPhone'], true);
@@ 596-606 (lines=11) @@
593
            $this->ValidateString('SenderName', $this->PostParams['SenderName'], 10);
594
            $this->ValidatePhoneNumber('SenderPhone', $this->PostParams['SenderPhone'], true);
595
            $this->ValidateCellphoneNumber('SenderCellPhone', $this->PostParams['SenderCellPhone'], true);
596
            if ($this->PostParams['LogisticsType'] == LogisticsType::HOME) {
597
                // 物流類型(LogisticsType)為宅配(Home)時,寄件人電話(SenderPhone)或寄件人手機(SenderCellPhone)不可為空
598
                if (empty($this->PostParams['SenderPhone']) and empty($this->PostParams['SenderCellPhone'])) {
599
                    throw new Exception('SenderPhone or SenderCellPhone is required when LogisticsType is Home.');
600
                }
601
            } elseif ($this->PostParams['LogisticsSubType'] == LogisticsSubType::HILIFE_C2C or $this->PostParams['LogisticsSubType'] == LogisticsSubType::UNIMART_C2C) {
602
                // 物流子類型(LogisticsSubType)為統一超商交貨便(UNIMARTC2C)、萊爾富店到店(HILIFEC2C)時,寄件人手機(SenderCellPhone)不可為空
603
                if (empty($this->PostParams['SenderCellPhone'])) {
604
                    throw new Exception('SenderCellPhone is required when LogisticsSubType is UNIMARTC2C or HILIFEC2C.');
605
                }
606
            }
607
608
            $this->ValidateString('ReceiverName', $this->PostParams['ReceiverName'], 10);
609
            $this->ValidatePhoneNumber('ReceiverPhone', $this->PostParams['ReceiverPhone'], true);