Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * @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));
 }
Пример #3
0
 function complex(int $real, int $imag)
 {
     return new Complex(integer($real), integer($imag));
 }
Пример #4
0
 public function testIntegerHelperFunction()
 {
     $integer = integer(15);
     $this->assertInstanceOf('Math\\Integer', $integer);
     $this->assertEquals($integer->getValue(), 15);
 }