Code Duplication    Length = 14-14 lines in 3 locations

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

@@ 1091-1104 (lines=14) @@
1088
        }
1089
1090
        // 規格分類1、2をそれぞれセットし作成
1091
        if ($row[$headerByKey['class_category1']] != '') {
1092
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category1']])) {
1093
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category1']]);
1094
                if (!$ClassCategory) {
1095
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1096
                    $this->addErrors($message);
1097
                } else {
1098
                    $ProductClass->setClassCategory1($ClassCategory);
1099
                }
1100
            } else {
1101
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1102
                $this->addErrors($message);
1103
            }
1104
        }
1105
1106
        if ($row[$headerByKey['class_category2']] != '') {
1107
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
@@ 1106-1119 (lines=14) @@
1103
            }
1104
        }
1105
1106
        if ($row[$headerByKey['class_category2']] != '') {
1107
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
1108
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]);
1109
                if (!$ClassCategory) {
1110
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1111
                    $this->addErrors($message);
1112
                } else {
1113
                    $ProductClass->setClassCategory2($ClassCategory);
1114
                }
1115
            } else {
1116
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1117
                $this->addErrors($message);
1118
            }
1119
        }
1120
1121
        if ($row[$headerByKey['delivery_date']] != '') {
1122
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
@@ 1121-1134 (lines=14) @@
1118
            }
1119
        }
1120
1121
        if ($row[$headerByKey['delivery_date']] != '') {
1122
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
1123
                $DeliveryDuration = $this->deliveryDurationRepository->find($row[$headerByKey['delivery_date']]);
1124
                if (!$DeliveryDuration) {
1125
                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1126
                    $this->addErrors($message);
1127
                } else {
1128
                    $ProductClass->setDeliveryDuration($DeliveryDuration);
1129
                }
1130
            } else {
1131
                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1132
                $this->addErrors($message);
1133
            }
1134
        }
1135
1136
        if (StringUtil::isNotBlank($row[$headerByKey['product_code']])) {
1137
            $ProductClass->setCode(StringUtil::trimAll($row[$headerByKey['product_code']]));