Code Duplication    Length = 11-14 lines in 2 locations

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

@@ 775-785 (lines=11) @@
772
        if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
773
            if ($productClassOrig->getTaxRate() !== false && $productClassOrig->getTaxRate() !== null) {
774
                $productClassDest->setTaxRate($productClassOrig->getTaxRate());
775
                if ($productClassDest->getTaxRule()) {
776
                    $productClassDest->getTaxRule()->setTaxRate($productClassOrig->getTaxRate());
777
                    $productClassDest->getTaxRule()->setDelFlg(Constant::DISABLED);
778
                } else {
779
                    $taxrule = $this->taxRuleRepository->newTaxRule();
780
                    $taxrule->setTaxRate($productClassOrig->getTaxRate());
781
                    $taxrule->setApplyDate(new \DateTime());
782
                    $taxrule->setProduct($productClassDest->getProduct());
783
                    $taxrule->setProductClass($productClassDest);
784
                    $productClassDest->setTaxRule($taxrule);
785
                }
786
            } else {
787
                if ($productClassDest->getTaxRule()) {
788
                    $productClassDest->getTaxRule()->setDelFlg(Constant::ENABLED);

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

@@ 443-456 (lines=14) @@
440
                    $BaseInfo = $this->baseInfoRepository->get();
441
                    if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
442
                        if ($ProductClass->getTaxRate() !== null) {
443
                            if ($ProductClass->getTaxRule()) {
444
                                if ($ProductClass->getTaxRule()->getDelFlg() == Constant::ENABLED) {
445
                                    $ProductClass->getTaxRule()->setDelFlg(Constant::DISABLED);
446
                                }
447
448
                                $ProductClass->getTaxRule()->setTaxRate($ProductClass->getTaxRate());
449
                            } else {
450
                                $taxrule = $this->taxRuleRepository->newTaxRule();
451
                                $taxrule->setTaxRate($ProductClass->getTaxRate());
452
                                $taxrule->setApplyDate(new \DateTime());
453
                                $taxrule->setProduct($Product);
454
                                $taxrule->setProductClass($ProductClass);
455
                                $ProductClass->setTaxRule($taxrule);
456
                            }
457
                        } else {
458
                            if ($ProductClass->getTaxRule()) {
459
                                $ProductClass->getTaxRule()->setDelFlg(Constant::ENABLED);