/** * Inverts the ratio by swapping the antecedent and consequent. * * @return Ratio */ public function invert() : Ratio { if ($this->dividend->equals($this->divisor)) { return $this; } return new static($this->divisor, $this->dividend); }