public function Fraction::reciprocate in Fraction 8
Same name and namespace in other branches
- 2.x src/Fraction.php \Drupal\fraction\Fraction::reciprocate()
Reciprocates the fraction.
Return value
Fraction Returns this Fraction object.
Overrides FractionInterface::reciprocate
File
- src/
Fraction.php, line 253
Class
- Fraction
- A simple class for representing and acting upon a fraction.
Namespace
Drupal\fractionCode
public function reciprocate() {
// Get the numerator and denominator, but flipped.
$numerator = $this
->getDenominator();
$denominator = $this
->getNumerator();
// Save the numerator and denominator.
$this
->setNumerator($numerator);
$this
->setDenominator($denominator);
return $this;
}