<commit_before><?php
declare(strict_types=1);

namespace Linio\Type;

class Money
{
    /**
     * Money amount in cents.
     *
     * @var int
     */
    protected $amount = 0;

    /**
     * Number of digits after the decimal place.
     *
     * @var int
     */
    protected $scale = 2;

    public function __construct(float $amount = 0)
    {
        $this->amount = $amount * 100;
    }

    public static function fromCents(float $cents): Money
    {
        $money = new self();
        $money->setAmount($cents);

        return $money;
    }

    public function add(Money $operand): Money
    {
        $result = $this->amount + $operand->getAmount();

        return self::fromCents($result);
    }

    public function subtract(Money $operand): Money
    {
        $result = $this->amount - $operand->getAmount();

        return self::fromCents($result);
    }

    public function multiply(float $multiplier): Money
    {
        $result = $this->amount * $multiplier;

        return self::fromCents($result);
    }

    public function divide(float $divisor): Money
    {
        $result = $this->amount / $divisor;

        return self::fromCents($result);
    }

    public function getPercentage(float $percentage): Money
    {
        $percentage = $percentage / 100;
        $result = $this->amount * $percentage;

        return self::fromCents($result);
    }

    public function applyPercentage(float $percentage): Money
    {
        $percentage = $this->getPercentage($percentage);

        return $this->add($percentage);
    }

    public function getInterest(float $rate, int $duration): Money
    {
        $interest = $rate / 100;
        $result = ($this->amount * $duration) * $interest;

        return self::fromCents($result);
    }

    public function applyInterest(float $rate, int $duration): Money
    {
        $interest = $this->getInterest($rate, $duration);

        return $this->add($interest);
    }

    public function equals($other): bool
    {
        if (!($other instanceof self)) {
            return false;
        }

        return $this->amount === $other->getAmount();
    }

    public function greaterThan(Money $other): bool<commit_msg>Used late static binding when creating Money instances.<commit_after><?php
declare(strict_types=1);

namespace Linio\Type;

class Money
{
    /**
     * Money amount in cents.
     *
     * @var int
     */
    protected $amount = 0;

    /**
     * Number of digits after the decimal place.
     *
     * @var int
     */
    protected $scale = 2;

    public function __construct(float $amount = 0)
    {
        $this->amount = $amount * 100;
    }

    public static function fromCents(float $cents): Money
    {
        $money = new static();
        $money->setAmount($cents);

        return $money;
    }

    public function add(Money $operand): Money
    {
        $result = $this->amount + $operand->getAmount();

        return static::fromCents($result);
    }

    public function subtract(Money $operand): Money
    {
        $result = $this->amount - $operand->getAmount();

        return static::fromCents($result);
    }

    public function multiply(float $multiplier): Money
    {
        $result = $this->amount * $multiplier;

        return static::fromCents($result);
    }

    public function divide(float $divisor): Money
    {
        $result = $this->amount / $divisor;

        return static::fromCents($result);
    }

    public function getPercentage(float $percentage): Money
    {
        $percentage = $percentage / 100;
        $result = $this->amount * $percentage;

        return static::fromCents($result);
    }

    public function applyPercentage(float $percentage): Money
    {
        $percentage = $this->getPercentage($percentage);

        return $this->add($percentage);
    }

    public function getInterest(float $rate, int $duration): Money
    {
        $interest = $rate / 100;
        $result = ($this->amount * $duration) * $interest;

        return static::fromCents($result);
    }

    public function applyInterest(float $rate, int $duration): Money
    {
        $interest = $this->getInterest($rate, $duration);

        return $this->add($interest);
    }

    public function equals($other): bool
    {
        if (!($other instanceof static)) {
            return false;
        }

        return $this->amount === $other->getAmount();
    }

    public function greaterThan(Money $other): bool
{'fraction_non_alphanumeric': 0.13182632050134288, 'fraction_numerical': 0.005819158460161146, 'mean_word_length': 2.307920059215396, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '7105926', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1255, 'n_words': 316}