Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 830-853 (lines=24) @@
827
            $ProductClass->setCode(null);
828
        }
829
830
        if ($row['在庫数無制限フラグ'] == '') {
831
            $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。');
832
        } else {
833
            if ($row['在庫数無制限フラグ'] == (string) Constant::DISABLED) {
834
                $ProductClass->setStockUnlimited(Constant::DISABLED);
835
                // 在庫数が設定されていなければエラー
836
                if ($row['在庫数'] == '') {
837
                    $this->addErrors(($data->key() + 1) . '行目の在庫数が設定されていません。');
838
                } else {
839
                    $stock = str_replace(',', '', $row['在庫数']);
840
                    if (preg_match('/^\d+$/', $stock) && $stock >= 0) {
841
                        $ProductClass->setStock($stock);
842
                    } else {
843
                        $this->addErrors(($data->key() + 1) . '行目の在庫数は0以上の数値を設定してください。');
844
                    }
845
                }
846
847
            } else if ($row['在庫数無制限フラグ'] == (string) Constant::ENABLED) {
848
                $ProductClass->setStockUnlimited(Constant::ENABLED);
849
                $ProductClass->setStock(null);
850
            } else {
851
                $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。');
852
            }
853
        }
854
855
        if ($row['販売制限数'] != '') {
856
            $saleLimit = str_replace(',', '', $row['販売制限数']);
@@ 992-1015 (lines=24) @@
989
            $ProductClass->setCode(null);
990
        }
991
992
        if ($row['在庫数無制限フラグ'] == '') {
993
            $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。');
994
        } else {
995
            if ($row['在庫数無制限フラグ'] == (string) Constant::DISABLED) {
996
                $ProductClass->setStockUnlimited(Constant::DISABLED);
997
                // 在庫数が設定されていなければエラー
998
                if ($row['在庫数'] == '') {
999
                    $this->addErrors(($data->key() + 1) . '行目の在庫数が設定されていません。');
1000
                } else {
1001
                    $stock = str_replace(',', '', $row['在庫数']);
1002
                    if (preg_match('/^\d+$/', $stock) && $stock >= 0) {
1003
                        $ProductClass->setStock($row['在庫数']);
1004
                    } else {
1005
                        $this->addErrors(($data->key() + 1) . '行目の在庫数は0以上の数値を設定してください。');
1006
                    }
1007
                }
1008
1009
            } else if ($row['在庫数無制限フラグ'] == (string) Constant::ENABLED) {
1010
                $ProductClass->setStockUnlimited(Constant::ENABLED);
1011
                $ProductClass->setStock(null);
1012
            } else {
1013
                $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。');
1014
            }
1015
        }
1016
1017
        if ($row['販売制限数'] != '') {
1018
            $saleLimit = str_replace(',', '', $row['販売制限数']);