/** * Allow users to override the default timeout * @param int $timeout Request timeout in seconds * $return bool True if param is an integer or integer string */ function set_timeout($timeout) { if (!is_integer($timeout)) { if (is_numeric($timeout)) { $this->timeout = integer($timeout); return true; } return false; } $this->timeout = $timeout; return true; }
/** * @return Rational */ public function getSimplified() : Rational { $gcd = $this->num->getGcd($this->denom)->getValue(); $newNum = $this->num->getValue() / $gcd; $newDenom = $this->denom->getValue() / $gcd; return new static(integer($newNum), integer($newDenom)); }
function complex(int $real, int $imag) { return new Complex(integer($real), integer($imag)); }
public function testIntegerHelperFunction() { $integer = integer(15); $this->assertInstanceOf('Math\\Integer', $integer); $this->assertEquals($integer->getValue(), 15); }