public function minus($value) { if ($value < 0) { return $this->plus(-1 * $value); } if (!is_int($value)) { throw new InvalidArgumentException('plus() takes an integer'); } if ($value == 0) { return clone $this; } // check boundaries try { $first_ip = $this->first_ip->minus(gmp_mul($value, $this->getNbAddresses())); return new $this->class($first_ip, $this->prefix); } catch (InvalidArgumentException $e) { throw new OutOfBoundsException($e->getMessage()); } }