<commit_before><?php

namespace Ayeo\Price\Calculator;

use Ayeo\Price\Currency;
use Ayeo\Price\Decorator\Price\DecoratorInterface;
use Ayeo\Price\Money;
use Ayeo\Price\Price;
use LogicException;

class StandardCalculator implements CalculatorInterface
{
    /** @var DecoratorInterface[] */
    private array $decorators;

    public function __construct(DecoratorInterface ...$decorators)
    {
        $this->decorators = $decorators;
    }

    public function add(Price $left, Price $right): Price
    {
        if ($left->isEmpty()) {
            return clone $right;
        }
        if ($right->isEmpty()) {
            return clone $left;
        }
        $this->compareCurrencySymbols($left->getCurrency(), $right->getCurrency());
        $currency = $this->buildCurrency($left, $right);
        $newGross = $left->getGross() + $right->getGross();
        $newNett = $left->getNett() + $right->getNett();
        $taxRate = $this->getTaxForPrices($left, $right);

        return $this->decoratePrice(new Price($newNett, $newGross, $currency, $taxRate));
    }

    public function subtract(Price $left, Price $right): Price
    {
        if ($left->isEmpty()) {
            return $this->decoratePrice(clone $left);
        }
        if ($right->isEmpty()) {
            return $this->decoratePrice(clone $left);
        }

        $this->compareCurrencySymbols($left->getCurrency(), $right->getCurrency());
        $currency = $this->buildCurrency($left, $right);
        if ($left->isGreaterThan($right)) {
            $newGross = $left->getGross() - $right->getGross();
            $newNett = $left->getNett() - $right->getNett();
            if ($newNett <= 0) { // in some situations with mixed taxes
                return Price::buildEmpty((string)$currency, $this->getTaxForPrices($left, $right) !== null);

            }

            return $this->decoratePrice(new Price($newNett, $newGross, $currency, $this->getTaxForPrices($left, $right)));
        }

        return Price::buildEmpty((string)$currency, $this->getTaxForPrices($left, $right) !== null);<commit_msg>Add blank line after conditions<commit_after><?php

namespace Ayeo\Price\Calculator;

use Ayeo\Price\Currency;
use Ayeo\Price\Decorator\Price\DecoratorInterface;
use Ayeo\Price\Money;
use Ayeo\Price\Price;
use LogicException;

class StandardCalculator implements CalculatorInterface
{
    /** @var DecoratorInterface[] */
    private array $decorators;

    public function __construct(DecoratorInterface ...$decorators)
    {
        $this->decorators = $decorators;
    }

    public function add(Price $left, Price $right): Price
    {
        if ($left->isEmpty()) {
            return clone $right;
        }

        if ($right->isEmpty()) {
            return clone $left;
        }

        $this->compareCurrencySymbols($left->getCurrency(), $right->getCurrency());
        $currency = $this->buildCurrency($left, $right);
        $newGross = $left->getGross() + $right->getGross();
        $newNett = $left->getNett() + $right->getNett();
        $taxRate = $this->getTaxForPrices($left, $right);

        return $this->decoratePrice(new Price($newNett, $newGross, $currency, $taxRate));
    }

    public function subtract(Price $left, Price $right): Price
    {
        if ($left->isEmpty()) {
            return $this->decoratePrice(clone $left);
        }

        if ($right->isEmpty()) {
            return $this->decoratePrice(clone $left);
        }

        $this->compareCurrencySymbols($left->getCurrency(), $right->getCurrency());
        $currency = $this->buildCurrency($left, $right);
        if ($left->isGreaterThan($right)) {
            $newGross = $left->getGross() - $right->getGross();
            $newNett = $left->getNett() - $right->getNett();
            if ($newNett <= 0) { // in some situations with mixed taxes
                return Price::buildEmpty((string)$currency, $this->getTaxForPrices($left, $right) !== null);

            }

            return $this->decoratePrice(new Price($newNett, $newGross, $currency, $this->getTaxForPrices($left, $right)));
        }

        return Price::buildEmpty((string)$currency, $this->getTaxForPrices($left, $right) !== null);
{'fraction_non_alphanumeric': 0.16003810431055013, 'fraction_numerical': 0.0004763038818766373, 'mean_word_length': 2.8461538461538463, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '959252', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1256, 'n_words': 245}