Code Duplication    Length = 14-14 lines in 3 locations

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

@@ 1009-1022 (lines=14) @@
1006
        }
1007
1008
        // 規格分類1、2をそれぞれセットし作成
1009
        if ($row[$headerByKey['class_category1']] != '') {
1010
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category1']])) {
1011
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category1']]);
1012
                if (!$ClassCategory) {
1013
                    $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1014
                    $this->addErrors($message);
1015
                } else {
1016
                    $ProductClass->setClassCategory1($ClassCategory);
1017
                }
1018
            } else {
1019
                $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category1']]);
1020
                $this->addErrors($message);
1021
            }
1022
        }
1023
1024
        if ($row[$headerByKey['class_category2']] != '') {
1025
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
@@ 1024-1037 (lines=14) @@
1021
            }
1022
        }
1023
1024
        if ($row[$headerByKey['class_category2']] != '') {
1025
            if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
1026
                $ClassCategory = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]);
1027
                if (!$ClassCategory) {
1028
                    $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1029
                    $this->addErrors($message);
1030
                } else {
1031
                    $ProductClass->setClassCategory2($ClassCategory);
1032
                }
1033
            } else {
1034
                $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
1035
                $this->addErrors($message);
1036
            }
1037
        }
1038
1039
        if ($row[$headerByKey['delivery_date']] != '') {
1040
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
@@ 1039-1052 (lines=14) @@
1036
            }
1037
        }
1038
1039
        if ($row[$headerByKey['delivery_date']] != '') {
1040
            if (preg_match('/^\d+$/', $row[$headerByKey['delivery_date']])) {
1041
                $DeliveryDuration = $this->deliveryDurationRepository->find($row[$headerByKey['delivery_date']]);
1042
                if (!$DeliveryDuration) {
1043
                    $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1044
                    $this->addErrors($message);
1045
                } else {
1046
                    $ProductClass->setDeliveryDuration($DeliveryDuration);
1047
                }
1048
            } else {
1049
                $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['delivery_date']]);
1050
                $this->addErrors($message);
1051
            }
1052
        }
1053
1054
        if (StringUtil::isNotBlank($row[$headerByKey['product_code']])) {
1055
            $ProductClass->setCode(StringUtil::trimAll($row[$headerByKey['product_code']]));