@param string $modulus

@throws \InvalidArgumentException

@return $this
343647
public function mod($modulus)
    {
        $this->number = bcmod($this->number, static::validatePositiveInteger($modulus));

        return $this;
    }
515850
public function setMode($mode) {
        if (!empty($mode)) {
            $mode = strtolower($mode);
            if (!array_key_exists($mode, $this->supportedModes)) {
                throw new \Cityware\Exception\InvalidArgumentException(
                "The mode $mode is not supported by " . __CLASS__
                );
            }
            $this->mode = $mode;
        }

        return $this;
    }
281975
public function setPlatform($platform)
    {
        if (!in_array($platform, array(Software::PLATFORM_MAC, Software::PLATFORM_IOS), true)) {
            throw new \InvalidArgumentException(sprintf('Undefined software platform "%s".', $platform));
        }

        $this->platform = $platform;

        return $this;
    }
777093
public function add($value)
    {
        if (! $value instanceof ModifierInterface) {
            throw new InvalidArgumentException(sprintf(
                '"%s" does not implement "%s"!',
                (is_object($value)) ? get_class($value) : $value,
                ModifierInterface::class
            ));
        }

        return parent::add($value);
    }
1221400
public function setConjunction($conjunction)
    {
        if (!is_string($conjunction)) {
            throw new InvalidArgumentException(
                'Conjunction should be a string.'
            );
        }

        $conjunction = strtoupper($conjunction);
        if (!in_array($conjunction, $this->validConjunctions())) {
            throw new InvalidArgumentException(sprintf(
                'Conjunction "%s" not allowed in this context.',
                $conjunction
            ));
        }

        $this->conjunction = $conjunction;
        return $this;
    }
1162019
public function setValue($value) {
		if (!$this->isPrimitive($value)) {
			throw new \InvalidArgumentException('Use setValue() only for primitives and PhpConstant, anyway use setExpression() instead.');
		}
		$this->value = $value;
		$this->hasValue = true;

		return $this;
	}
1347332
public function setMode($mode)
    {
        $availableModes = $this->availableModes();
        if (!in_array($mode, $availableModes)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid ID mode. Must be one of "%s"',
                implode(', ', $availableModes)
            ));
        }

        $this->mode = $mode;

        return $this;
    }
321616
public function setKey($key)
    {
        try {
            $this->blockCipher->setKey($key);
        } catch (CryptException\InvalidArgumentException $e) {
            throw new Exception\InvalidArgumentException($e->getMessage());
        }
        $this->encryption['key'] = $key;
        return $this;
    }
1281874
public function setCallback($callback)
    {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException('Expected a callable. Got an uncallable '. gettype($callback));
        }

        $this->callback = $callback;

        return $this;
    }
447611
public function setHost($host) {
        $this->host = (string) $host;
        if (empty($this->host)) {
            throw new InvalidArgumentException('empty host');
        }
        return $this;
    }
1354190
public function set($requiredType)
    {
        if (!in_array($requiredType, $this->validTypes)) {
            throw new \InvalidArgumentException("{$requiredType} is not a supported number type");
        }
        if ($requiredType == self::TYPE_GMP && !extension_loaded('gmp')) {
            throw new \InvalidArgumentException('GMP not supported');
        }

        $this->requiredType = $requiredType;

        return $this;
    }
1105165
public function divide($divisor, $roundingMode = self::ROUND_HALF_UP)
    {
        $this->assertOperand($divisor);
        $this->assertRoundingMode($roundingMode);

        if ($divisor == 0) {
            throw new InvalidArgumentException('Division by zero');
        }

        return new self(round($this->amount / $divisor, $this->currency->getPrecision(), $roundingMode), $this->currency);
    }
754663
public function offset(int $offset = 0): Select
    {
        if (!\is_int($offset) || $offset < 0) {
            throw new InvalidArgumentException('$offset have to be a positive integer or a zero');
        }
        $this->offset = $offset;
        return $this;
    }
957766
public function inv($number, $modulus)
    {
        if ($this->coprime($number, $modulus) === false) {
            return '0';
        }

        $a = '1';
        $b = '0';
        $z = '0';
        $c = '0';

        list($modulus, $number) = array($this->bcNormalize($modulus), $this->bcNormalize($number));
        list($mod, $num)        = array($modulus, $number);

        try {

            do {
                list($z, $c)     = $this->modDiv($num, $mod);
                list($mod, $num) = array($z, $mod);

                $z = $this->subMul($a, $b, $c);

                list($a, $b) = array($b, $z);
            } while (bccomp($mod, '0') > 0);

            return $this->addMod($a, $modulus);

        } catch (\Exception $e) {
            throw $e;
        }
    }
340239
protected function setMode($mode)
    {
        $mode = substr((string) $mode, 0, 2);
        if (!in_array($mode, $this->validModes, true)) {
            throw new \InvalidArgumentException("The given mode '$mode' is not valid for the requested operation");
        }
        $this->mode = $mode;

        return $this;
    }
1344937
public function setFunc($func)
    {
        if ($func === null) {
            $this->func = $func;
            return $this;
        }

        if (!is_string($func)) {
            throw new InvalidArgumentException(
                'Function name should be a string.'
            );
        }

        $func = strtoupper($func);
        if (!in_array($func, $this->validFunc())) {
            throw new InvalidArgumentException(sprintf(
                'Function "%s" not allowed in this context.',
                $func
            ));
        }

        $this->func = $func;
        return $this;
    }
87839
public function setMode($mode = self::MODE_WHITESPACE_ONLY)
    {
        if (!in_array($mode, $this->availableModes)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'The mode "%s" is not available.',
                $mode
            ));
        }

        $this->mode = (string) $mode;

        return $this;
    }