Code Duplication    Length = 8-10 lines in 2 locations

src/Darryldecode/Cart/Cart.php 2 locations

@@ 600-609 (lines=10) @@
597
        $newTotal = 0.00;
598
        $process = 0;
599
600
        $conditions->each(function (CartCondition $cond) use ($sum, &$newTotal, &$process) {
601
602
            // if this is the first iteration, the toBeCalculated
603
            // should be the sum as initial point of value.
604
            $toBeCalculated = ($process > 0) ? $newTotal : $sum;
605
606
            $newTotal = $cond->applyCondition($toBeCalculated);
607
608
            $process++;
609
        });
610
611
        return Helpers::formatValue(floatval($newTotal), $formatted, $this->config);
612
    }
@@ 639-646 (lines=8) @@
636
        }
637
638
        $conditions
639
            ->each(function (CartCondition $cond) use ($subTotal, &$newTotal, &$process) {
640
                $toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
641
642
                $newTotal = $cond->applyCondition($toBeCalculated);
643
644
                $process++;
645
            });
646
647
        return Helpers::formatValue($newTotal, $this->config['format_numbers'], $this->config);
648
    }
649