Code Duplication    Length = 11-14 lines in 2 locations

src/Eccube/Controller/Admin/Product/ProductClassController.php 1 location

@@ 674-684 (lines=11) @@
671
        if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
672
            if ($productClassOrig->getTaxRate() !== false && $productClassOrig->getTaxRate() !== null) {
673
                $productClassDest->setTaxRate($productClassOrig->getTaxRate());
674
                if ($productClassDest->getTaxRule()) {
675
                    $productClassDest->getTaxRule()->setTaxRate($productClassOrig->getTaxRate());
676
                    $productClassDest->getTaxRule()->setDelFlg(Constant::DISABLED);
677
                } else {
678
                    $taxrule = $app['eccube.repository.tax_rule']->newTaxRule();
679
                    $taxrule->setTaxRate($productClassOrig->getTaxRate());
680
                    $taxrule->setApplyDate(new \DateTime());
681
                    $taxrule->setProduct($productClassDest->getProduct());
682
                    $taxrule->setProductClass($productClassDest);
683
                    $productClassDest->setTaxRule($taxrule);
684
                }
685
            } else {
686
                if ($productClassDest->getTaxRule()) {
687
                    $productClassDest->getTaxRule()->setDelFlg(Constant::ENABLED);

src/Eccube/Controller/Admin/Product/ProductController.php 1 location

@@ 322-335 (lines=14) @@
319
                    $BaseInfo = $app['eccube.repository.base_info']->get();
320
                    if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
321
                        if ($ProductClass->getTaxRate() !== null) {
322
                            if ($ProductClass->getTaxRule()) {
323
                                if ($ProductClass->getTaxRule()->getDelFlg() == Constant::ENABLED) {
324
                                    $ProductClass->getTaxRule()->setDelFlg(Constant::DISABLED);
325
                                }
326
327
                                $ProductClass->getTaxRule()->setTaxRate($ProductClass->getTaxRate());
328
                            } else {
329
                                $taxrule = $app['eccube.repository.tax_rule']->newTaxRule();
330
                                $taxrule->setTaxRate($ProductClass->getTaxRate());
331
                                $taxrule->setApplyDate(new \DateTime());
332
                                $taxrule->setProduct($Product);
333
                                $taxrule->setProductClass($ProductClass);
334
                                $ProductClass->setTaxRule($taxrule);
335
                            }
336
                        } else {
337
                            if ($ProductClass->getTaxRule()) {
338
                                $ProductClass->getTaxRule()->setDelFlg(Constant::ENABLED);