Code Duplication    Length = 8-10 lines in 2 locations

src/Darryldecode/Cart/Cart.php 2 locations

@@ 595-604 (lines=10) @@
592
        $newTotal = 0.00;
593
        $process = 0;
594
595
        $conditions->each(function (CartCondition $cond) use ($sum, &$newTotal, &$process) {
596
597
            // if this is the first iteration, the toBeCalculated
598
            // should be the sum as initial point of value.
599
            $toBeCalculated = ($process > 0) ? $newTotal : $sum;
600
601
            $newTotal = $cond->applyCondition($toBeCalculated);
602
603
            $process++;
604
        });
605
606
        return Helpers::formatValue(floatval($newTotal), $formatted, $this->config);
607
    }
@@ 634-641 (lines=8) @@
631
        }
632
633
        $conditions
634
            ->each(function (CartCondition $cond) use ($subTotal, &$newTotal, &$process) {
635
                $toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
636
637
                $newTotal = $cond->applyCondition($toBeCalculated);
638
639
                $process++;
640
            });
641
642
        return Helpers::formatValue($newTotal, $this->config['format_numbers'], $this->config);
643
    }
644