Code Duplication    Length = 14-14 lines in 3 locations

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

@@ 1030-1043 (lines=14) @@
1027
        }
1028
1029
        // 規格分類1、2をそれぞれセットし作成
1030
        if ($row[$headerByKey['class_category1']] != '') {
1031
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category1']])) {
1032
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category1']]);
1033
                if (!$ClassCategory) {
1034
                    $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1035
                    $this->addErrors($message);
1036
                } else {
1037
                    $ProductClass->setClassCategory1($ClassCategory);
1038
                }
1039
            } else {
1040
                $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1041
                $this->addErrors($message);
1042
            }
1043
        }
1044
1045
        if ($row[$headerByKey['class_category2']] != '') {
1046
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
@@ 1045-1058 (lines=14) @@
1042
            }
1043
        }
1044
1045
        if ($row[$headerByKey['class_category2']] != '') {
1046
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
1047
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]);
1048
                if (!$ClassCategory) {
1049
                    $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1050
                    $this->addErrors($message);
1051
                } else {
1052
                    $ProductClass->setClassCategory2($ClassCategory);
1053
                }
1054
            } else {
1055
                $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1056
                $this->addErrors($message);
1057
            }
1058
        }
1059
1060
        if ($row[$headerByKey['delivery_date']] != '') {
1061
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
@@ 1060-1073 (lines=14) @@
1057
            }
1058
        }
1059
1060
        if ($row[$headerByKey['delivery_date']] != '') {
1061
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
1062
                $DeliveryDuration = $this->deliveryDurationRepository->find($row[$headerByKey['delivery_date']]);
1063
                if (!$DeliveryDuration) {
1064
                    $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1065
                    $this->addErrors($message);
1066
                } else {
1067
                    $ProductClass->setDeliveryDuration($DeliveryDuration);
1068
                }
1069
            } else {
1070
                $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1071
                $this->addErrors($message);
1072
            }
1073
        }
1074
1075
        if (StringUtil::isNotBlank($row[$headerByKey['product_code']])) {
1076
            $ProductClass->setCode(StringUtil::trimAll($row[$headerByKey['product_code']]));