/** * Compares the Ratio with another at the specified scale. * * @param Ratio $other * @param int $scale * * @return int An integer less than, equal to or greater than 0 when this instance is respectively less than, * equal to or greater than the $other instance. */ public function compare(Ratio $other, int $scale = null) : int { if ($this === $other) { return 0; } return $this->toDecimal()->compare($other->toDecimal(), $scale); }
/** * Creates a new instance from a Ratio. * * @param Ratio $ratio * @param int|null $scale * * @return Decimal */ public static function fromRatio(Ratio $ratio, int $scale = null) : Decimal { return $ratio->toDecimal($scale); }