Code Duplication    Length = 14-14 lines in 4 locations

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

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