Code Duplication    Length = 38-38 lines in 2 locations

sdk/ECPay.Logistics.Integration.php 2 locations

@@ 333-370 (lines=38) @@
330
            $this->ValidateLogisticsSubType();
331
332
            // 依不同的物流類型(LogisticsType)設定專屬參數並檢查
333
            switch ($this->PostParams['LogisticsType']) {
334
                case LogisticsType::CVS:
335
                    $CvsParamList = [
336
                        'ReceiverStoreID' => '',
337
                        'ReturnStoreID' => '',
338
                    ];
339
                    $this->PostParams = $this->GetPostParams($this->SendExtend, $CvsParamList, $this->PostParams);
340
341
                    $this->ValidateMixTypeID('ReceiverStoreID', $this->PostParams['ReceiverStoreID'], 6);
342
                    $this->ValidateMixTypeID('ReturnStoreID', $this->PostParams['ReturnStoreID'], 6, true);
343
                    break;
344
                case LogisticsType::HOME:
345
                    $HomeParamList = [
346
                        'SenderZipCode' => '',
347
                        'SenderAddress' => '',
348
                        'ReceiverZipCode' => '',
349
                        'ReceiverAddress' => '',
350
                        'Temperature' => Temperature::ROOM,
351
                        'Distance' => Distance::SAME,
352
                        'Specification' => Specification::CM_60,
353
                        'ScheduledDeliveryTime' => '',
354
                        'ScheduledDeliveryDate' => '',
355
                        'PackageCount' => 0,
356
                    ];
357
                    $this->PostParams = $this->GetPostParams($this->SendExtend, $HomeParamList, $this->PostParams);
358
                    $this->PostParams['ScheduledPickupTime'] = ScheduledPickupTime::UNLIMITED;
359
360
                    $this->ValidateZipCode('SenderZipCode', $this->PostParams['SenderZipCode']);
361
                    $this->ValidateAddress('SenderAddress', $this->PostParams['SenderAddress'], 6, 60);
362
                    $this->ValidateZipCode('ReceiverZipCode', $this->PostParams['ReceiverZipCode']);
363
                    $this->ValidateAddress('ReceiverAddress', $this->PostParams['ReceiverAddress'], 6, 60);
364
                    $this->ValidateTemperature();
365
                    $this->ValidateDistance();
366
                    $this->ValidateSpecification();
367
                    $this->ValidateScheduledDeliveryTime(true);
368
                    break;
369
                default:
370
            }
371
372
            $this->ValidateAmount('GoodsAmount', $this->PostParams['GoodsAmount']);
373
            if (
@@ 524-561 (lines=38) @@
521
            $this->ValidateLogisticsSubType();
522
523
            // 依不同的物流類型(LogisticsType)設定專屬參數並檢查
524
            switch ($this->PostParams['LogisticsType']) {
525
                case LogisticsType::CVS:
526
                    $CvsParamList = [
527
                        'ReceiverStoreID' => '',
528
                        'ReturnStoreID' => '',
529
                    ];
530
                    $this->PostParams = $this->GetPostParams($this->SendExtend, $CvsParamList, $this->PostParams);
531
532
                    $this->ValidateMixTypeID('ReceiverStoreID', $this->PostParams['ReceiverStoreID'], 6);
533
                    $this->ValidateMixTypeID('ReturnStoreID', $this->PostParams['ReturnStoreID'], 6, true);
534
                    break;
535
                case LogisticsType::HOME:
536
                    $HomeParamList = [
537
                        'SenderZipCode' => '',
538
                        'SenderAddress' => '',
539
                        'ReceiverZipCode' => '',
540
                        'ReceiverAddress' => '',
541
                        'Temperature' => Temperature::ROOM,
542
                        'Distance' => Distance::SAME,
543
                        'Specification' => Specification::CM_60,
544
                        'ScheduledDeliveryTime' => '',
545
                        'ScheduledDeliveryDate' => '',
546
                        'PackageCount' => 0,
547
                    ];
548
                    $this->PostParams = $this->GetPostParams($this->SendExtend, $HomeParamList, $this->PostParams);
549
                    $this->PostParams['ScheduledPickupTime'] = ScheduledPickupTime::UNLIMITED;
550
551
                    $this->ValidateZipCode('SenderZipCode', $this->PostParams['SenderZipCode']);
552
                    $this->ValidateAddress('SenderAddress', $this->PostParams['SenderAddress'], 6, 60);
553
                    $this->ValidateZipCode('ReceiverZipCode', $this->PostParams['ReceiverZipCode']);
554
                    $this->ValidateAddress('ReceiverAddress', $this->PostParams['ReceiverAddress'], 6, 60);
555
                    $this->ValidateTemperature();
556
                    $this->ValidateDistance();
557
                    $this->ValidateSpecification();
558
                    $this->ValidateScheduledDeliveryTime(true);
559
                    break;
560
                default:
561
            }
562
563
            $this->ValidateAmount('GoodsAmount', $this->PostParams['GoodsAmount']);
564
            if (