Code Duplication    Length = 13-15 lines in 2 locations

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

@@ 312-324 (lines=13) @@
309
                                    if (isset($row[$headerByKey['class_category2']]) && StringUtil::isNotBlank($row[$headerByKey['class_category2']])) {
310
                                        if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
311
                                            $ClassCategory2 = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]);
312
                                            if (!$ClassCategory2) {
313
                                                $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
314
                                                $this->addErrors($message);
315
                                            } else {
316
                                                if ($ClassCategory1 &&
317
                                                    ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId())
318
                                                ) {
319
                                                    $message = trans('csvimportcontroller.notsame', ['%line%' => $line, '%name1%' => $headerByKey['class_category1'], '%name2%' => $headerByKey['class_category2']]);
320
                                                    $this->addErrors($message);
321
                                                } else {
322
                                                    $ProductClass->setClassCategory2($ClassCategory2);
323
                                                }
324
                                            }
325
                                        } else {
326
                                            $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
327
                                            $this->addErrors($message);
@@ 416-430 (lines=15) @@
413
                                        } else {
414
                                            if (preg_match('/^\d+$/', $classCategoryId2)) {
415
                                                $ClassCategory2 = $this->classCategoryRepository->find($classCategoryId2);
416
                                                if (!$ClassCategory2) {
417
                                                    $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
418
                                                    $this->addErrors($message);
419
                                                } else {
420
                                                    if ($ClassCategory1 &&
421
                                                        ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId())
422
                                                    ) {
423
                                                        $message = trans('csvimportcontroller.notsame', [
424
                                                            '%line%' => $line,
425
                                                            '%name1%' => $headerByKey['class_category1'],
426
                                                            '%name2%' => $headerByKey['class_category2'],
427
                                                        ]);
428
                                                        $this->addErrors($message);
429
                                                    }
430
                                                }
431
                                            } else {
432
                                                $message = trans('csvimportcontroller.notfound', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
433
                                                $this->addErrors($message);