Code Duplication    Length = 7-8 lines in 4 locations

sdk/AllPay.Payment.Integration.php 4 locations

@@ 1205-1211 (lines=7) @@
1202
        $arErrors = [];
1203
1204
        // 廠商自訂編號RelateNumber(不可為空)
1205
        if (! array_key_exists('RelateNumber', $arExtend)) {
1206
            array_push($arErrors, 'RelateNumber is required.');
1207
        } else {
1208
            if (strlen($arExtend['RelateNumber']) > 30) {
1209
                array_push($arErrors, 'RelateNumber max length as 30.');
1210
            }
1211
        }
1212
1213
        // 統一編號CustomerIdentifier(預設為空字串)
1214
        if (! array_key_exists('CustomerIdentifier', $arExtend)) {
@@ 1214-1221 (lines=8) @@
1211
        }
1212
1213
        // 統一編號CustomerIdentifier(預設為空字串)
1214
        if (! array_key_exists('CustomerIdentifier', $arExtend)) {
1215
            $arExtend['CustomerIdentifier'] = '';
1216
        } else {
1217
            //統編長度只能為8
1218
            if (strlen($arExtend['CustomerIdentifier']) != 8) {
1219
                array_push($arErrors, 'CustomerIdentifier length should be 8.');
1220
            }
1221
        }
1222
1223
        // 載具類別CarruerType(預設為None)
1224
        if (! array_key_exists('CarruerType', $arExtend)) {
@@ 1291-1297 (lines=7) @@
1288
            }
1289
        }
1290
        // 客戶電話CustomerPhone
1291
        if (! array_key_exists('CustomerPhone', $arExtend)) {
1292
            $arExtend['CustomerPhone'] = '';
1293
        } else {
1294
            if (strlen($arExtend['CustomerPhone']) > 20) {
1295
                array_push($arErrors, 'CustomerPhone max length as 20.');
1296
            }
1297
        }
1298
1299
        // 客戶信箱CustomerEmail
1300
        if (! array_key_exists('CustomerEmail', $arExtend)) {
@@ 1300-1306 (lines=7) @@
1297
        }
1298
1299
        // 客戶信箱CustomerEmail
1300
        if (! array_key_exists('CustomerEmail', $arExtend)) {
1301
            $arExtend['CustomerEmail'] = '';
1302
        } else {
1303
            if (strlen($arExtend['CustomerEmail']) > 200) {
1304
                array_push($arErrors, 'CustomerEmail max length as 200.');
1305
            }
1306
        }
1307
1308
        //(CustomerEmail與CustomerPhone擇一不可為空)
1309
        if (strlen($arExtend['CustomerPhone']) == 0 and strlen($arExtend['CustomerEmail']) == 0) {