public function allocateByRatios(array $ratios)
    {
        /** @var Money[] $result */
        $result = array();
        $total = array_sum($ratios);
        $remainder = $this->amount;

        for ($i = 0; $i < count($ratios); $i++) {
            $amount = $this->castToFloat($this->amount * $ratios[$i] / $total);
            $result[] = $this->newMoney($amount);
            $remainder -= $amount;
        }

        for ($i = 0; $i < $remainder; $i++) {
            $result[$i] = $this->newMoney($result[$i]->getAmount() + 1);
        }

        return $result;
    }