Code Duplication    Length = 14-14 lines in 3 locations

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

@@ 1205-1218 (lines=14) @@
1202
        }
1203
1204
        // 規格分類1、2をそれぞれセットし作成
1205
        if ($row[$headerByKey['class_category1']] != '') {
1206
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category1']])) {
1207
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category1']]);
1208
                if (!$ClassCategory) {
1209
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1210
                    $this->addErrors($message);
1211
                } else {
1212
                    $ProductClass->setClassCategory1($ClassCategory);
1213
                }
1214
            } else {
1215
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1216
                $this->addErrors($message);
1217
            }
1218
        }
1219
1220
        if ($row[$headerByKey['class_category2']] != '') {
1221
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
@@ 1220-1233 (lines=14) @@
1217
            }
1218
        }
1219
1220
        if ($row[$headerByKey['class_category2']] != '') {
1221
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
1222
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]);
1223
                if (!$ClassCategory) {
1224
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1225
                    $this->addErrors($message);
1226
                } else {
1227
                    $ProductClass->setClassCategory2($ClassCategory);
1228
                }
1229
            } else {
1230
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1231
                $this->addErrors($message);
1232
            }
1233
        }
1234
1235
        if ($row[$headerByKey['delivery_date']] != '') {
1236
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
@@ 1235-1248 (lines=14) @@
1232
            }
1233
        }
1234
1235
        if ($row[$headerByKey['delivery_date']] != '') {
1236
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
1237
                $DeliveryDuration = $this->deliveryDurationRepository->find($row[$headerByKey['delivery_date']]);
1238
                if (!$DeliveryDuration) {
1239
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1240
                    $this->addErrors($message);
1241
                } else {
1242
                    $ProductClass->setDeliveryDuration($DeliveryDuration);
1243
                }
1244
            } else {
1245
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1246
                $this->addErrors($message);
1247
            }
1248
        }
1249
1250
        if (StringUtil::isNotBlank($row[$headerByKey['product_code']])) {
1251
            $ProductClass->setCode(StringUtil::trimAll($row[$headerByKey['product_code']]));