Code Duplication    Length = 7-8 lines in 4 locations

sdk/ECPay.Payment.Integration.php 4 locations

@@ 901-907 (lines=7) @@
898
        $arErrors = [];
899
900
        // 廠商自訂編號RelateNumber(不可為空)
901
        if (! array_key_exists('RelateNumber', $arExtend)) {
902
            array_push($arErrors, 'RelateNumber is required.');
903
        } else {
904
            if (strlen($arExtend['RelateNumber']) > 30) {
905
                array_push($arErrors, 'RelateNumber max length as 30.');
906
            }
907
        }
908
909
        // 統一編號CustomerIdentifier(預設為空字串)
910
        if (! array_key_exists('CustomerIdentifier', $arExtend)) {
@@ 910-917 (lines=8) @@
907
        }
908
909
        // 統一編號CustomerIdentifier(預設為空字串)
910
        if (! array_key_exists('CustomerIdentifier', $arExtend)) {
911
            $arExtend['CustomerIdentifier'] = '';
912
        } else {
913
            //統編長度只能為8
914
            if (strlen($arExtend['CustomerIdentifier']) != 8) {
915
                array_push($arErrors, 'CustomerIdentifier length should be 8.');
916
            }
917
        }
918
919
        // 載具類別CarrierType(預設為None)
920
        if (! array_key_exists('CarrierType', $arExtend)) {
@@ 991-997 (lines=7) @@
988
            }
989
        }
990
        // 客戶電話CustomerPhone
991
        if (! array_key_exists('CustomerPhone', $arExtend)) {
992
            $arExtend['CustomerPhone'] = '';
993
        } else {
994
            if (strlen($arExtend['CustomerPhone']) > 20) {
995
                array_push($arErrors, 'CustomerPhone max length as 20.');
996
            }
997
        }
998
999
        // 客戶信箱CustomerEmail
1000
        if (! array_key_exists('CustomerEmail', $arExtend)) {
@@ 1000-1006 (lines=7) @@
997
        }
998
999
        // 客戶信箱CustomerEmail
1000
        if (! array_key_exists('CustomerEmail', $arExtend)) {
1001
            $arExtend['CustomerEmail'] = '';
1002
        } else {
1003
            if (strlen($arExtend['CustomerEmail']) > 200) {
1004
                array_push($arErrors, 'CustomerEmail max length as 200.');
1005
            }
1006
        }
1007
1008
        //(CustomerEmail與CustomerPhone擇一不可為空)
1009
        if (strlen($arExtend['CustomerPhone']) == 0 and strlen($arExtend['CustomerEmail']) == 0) {