Code Duplication    Length = 8-10 lines in 2 locations

src/Darryldecode/Cart/Cart.php 2 locations

@@ 581-590 (lines=10) @@
578
        $newTotal = 0.00;
579
        $process = 0;
580
581
        $conditions->each(function (CartCondition $cond) use ($sum, &$newTotal, &$process) {
582
583
            // if this is the first iteration, the toBeCalculated
584
            // should be the sum as initial point of value.
585
            $toBeCalculated = ($process > 0) ? $newTotal : $sum;
586
587
            $newTotal = $cond->applyCondition($toBeCalculated);
588
589
            $process++;
590
        });
591
592
        return Helpers::formatValue(floatval($newTotal), $formatted, $this->config);
593
    }
@@ 620-627 (lines=8) @@
617
        }
618
619
        $conditions
620
            ->each(function (CartCondition $cond) use ($subTotal, &$newTotal, &$process) {
621
                $toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
622
623
                $newTotal = $cond->applyCondition($toBeCalculated);
624
625
                $process++;
626
627
            });
628
629
        return Helpers::formatValue($newTotal, $this->config['format_numbers'], $this->config);
630
    }