/** * Divide a value * * @param int|float $number The number * * @throws DivisionByZeroException * @return Calculate */ public function divide($number) { if (Number::isZero($number)) { throw new DivisionByZeroException(); } $this->number = $this->number / $number; return $this; }
/** * Read content from file * * @param int $length Length of content to read * @param bool $asArray Get as array * * @return array|string|bool */ public function read($length = 0, $asArray = false) { if ($asArray && Number::isZero($length)) { return file($this->file); } elseif (Number::isPositive($length)) { $this->setHandle('r'); return fread($this->handle, $length); } else { return Collection::implode($this->read(0, true), ''); } }
/** * */ public function testIsInfiniteWithWrongDatatype() { $this->assertFalse(Number::isInfinite(0)); }