public function Fraction::setNumerator in Fraction 2.x
Same name and namespace in other branches
- 8 src/Fraction.php \Drupal\fraction\Fraction::setNumerator()
Sets the numerator.
Parameters
string|int $numerator: The numerator value.
Return value
Fraction Returns this Fraction object.
Overrides FractionInterface::setNumerator
8 calls to Fraction::setNumerator()
- Fraction::add in src/
Fraction.php - Adds another fraction to this one.
- Fraction::divide in src/
Fraction.php - Divides this fraction by another one.
- Fraction::multiply in src/
Fraction.php - Multiplies this fraction with another one.
- Fraction::reciprocate in src/
Fraction.php - Reciprocates the fraction.
- Fraction::reduce in src/
Fraction.php - Reduces the fraction to its simplest form.
File
- src/
Fraction.php, line 67
Class
- Fraction
- A simple class for representing and acting upon a fraction.
Namespace
Drupal\fractionCode
public function setNumerator($value) {
// Cast the value as a string and save it.
$this->numerator = (string) $value;
return $this;
}