You are here

public function Fraction::setNumerator in Fraction 8

Same name and namespace in other branches
  1. 2.x 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.

... See full list

File

src/Fraction.php, line 75

Class

Fraction
A simple class for representing and acting upon a fraction.

Namespace

Drupal\fraction

Code

public function setNumerator($value) {

  // Cast the value as a string and save it.
  $this->numerator = (string) $value;
  return $this;
}