Code Duplication    Length = 14-14 lines in 4 locations

src/Eccube/Controller/Admin/Product/CsvImportController.php 4 locations

@@ 1117-1130 (lines=14) @@
1114
        $ProductClass->setClassCategory1($ClassCategory1);
1115
        $ProductClass->setClassCategory2($ClassCategory2);
1116
1117
        if (isset($row[$headerByKey['delivery_date']]) && StringUtil::isNotBlank($row[$headerByKey['delivery_date']])) {
1118
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
1119
                $DeliveryDuration = $this->deliveryDurationRepository->find($row[$headerByKey['delivery_date']]);
1120
                if (!$DeliveryDuration) {
1121
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1122
                    $this->addErrors($message);
1123
                } else {
1124
                    $ProductClass->setDeliveryDuration($DeliveryDuration);
1125
                }
1126
            } else {
1127
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1128
                $this->addErrors($message);
1129
            }
1130
        }
1131
1132
        if (isset($row[$headerByKey['product_code']]) && StringUtil::isNotBlank($row[$headerByKey['product_code']])) {
1133
            $ProductClass->setCode(StringUtil::trimAll($row[$headerByKey['product_code']]));
@@ 1265-1278 (lines=14) @@
1262
        }
1263
1264
        // 規格分類1、2をそれぞれセットし作成
1265
        if (isset($row[$headerByKey['class_category1']]) && $row[$headerByKey['class_category1']] != '') {
1266
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category1']])) {
1267
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category1']]);
1268
                if (!$ClassCategory) {
1269
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1270
                    $this->addErrors($message);
1271
                } else {
1272
                    $ProductClass->setClassCategory1($ClassCategory);
1273
                }
1274
            } else {
1275
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1276
                $this->addErrors($message);
1277
            }
1278
        }
1279
1280
        if (isset($row[$headerByKey['class_category2']]) && $row[$headerByKey['class_category2']] != '') {
1281
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
@@ 1280-1293 (lines=14) @@
1277
            }
1278
        }
1279
1280
        if (isset($row[$headerByKey['class_category2']]) && $row[$headerByKey['class_category2']] != '') {
1281
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
1282
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]);
1283
                if (!$ClassCategory) {
1284
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1285
                    $this->addErrors($message);
1286
                } else {
1287
                    $ProductClass->setClassCategory2($ClassCategory);
1288
                }
1289
            } else {
1290
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1291
                $this->addErrors($message);
1292
            }
1293
        }
1294
1295
        if (isset($row[$headerByKey['delivery_date']]) && $row[$headerByKey['delivery_date']] != '') {
1296
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
@@ 1295-1308 (lines=14) @@
1292
            }
1293
        }
1294
1295
        if (isset($row[$headerByKey['delivery_date']]) && $row[$headerByKey['delivery_date']] != '') {
1296
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
1297
                $DeliveryDuration = $this->deliveryDurationRepository->find($row[$headerByKey['delivery_date']]);
1298
                if (!$DeliveryDuration) {
1299
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1300
                    $this->addErrors($message);
1301
                } else {
1302
                    $ProductClass->setDeliveryDuration($DeliveryDuration);
1303
                }
1304
            } else {
1305
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1306
                $this->addErrors($message);
1307
            }
1308
        }
1309
1310
        if (isset($row[$headerByKey['product_code']]) && StringUtil::isNotBlank($row[$headerByKey['product_code']])) {
1311
            $ProductClass->setCode(StringUtil::trimAll($row[$headerByKey['product_code']]));