Assert that the value is scalar.

@param mixed  $value
@param string $message

@return void

@throws InvalidArgumentException
161907
public static function isScalar($value, $message = null)
    {
        if (!is_scalar($value)) {
            throw new InvalidArgumentException(sprintf(
                $message ?: 'Expected scalar, but got %s',
                Helper::typeToString($value)
            ));
        }
    }
950351
public static function isNullOrResource($value, $message = null)
    {
        if (!is_null($value) && !is_resource($value)) {
            throw new InvalidArgumentException(sprintf(
                $message ?: 'Expected null or resource, but got %s',
                Helper::typeToString($value)
            ));
        }
    }
54286
public static function assertScalar($actual, string $message = '')
    {
        self::assertTypeOfScalar($actual, $message, 'assertScalar', new ScalarConstraint(ScalarConstraint::TYPE_SCALAR));
    }
1142207
protected function setValue($value)
    {
        if (! is_bool($value)) {
            throw InvalidTypeException::fromMessageAndPrototype("Value must be a boolean", static::prototype());
        }

        $this->value = $value;
    }
1138218
protected function checkValueStructure(BaseValue $value)
    {
        if (!is_int($value->destinationContentId) && !is_string($value->destinationContentId)) {
            throw new InvalidArgumentType(
                '$value->destinationContentId',
                'string|int',
                $value->destinationContentId
            );
        }
    }
1107215
public function add($value)
    {
        if (!$value instanceof EmailBodyPart) {
            throw new InvalidArgumentException(
                sprintf(
                    '%s only accepts instances of %s.',
                    __FUNCTION__, EmailBodyPart::class
                )
            );
        }

        return parent::add($value);
    }
766466
public function pow($value)
    {
        if (!is_int($value) && !ctype_digit($value)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid exponent "%s" provided. Only integers are allowed.',
                $value
            ));
        }

        $newValue = bcpow($this->getValue(), $value, $this->getScale());

        return $this->assignValue($newValue);
    }
782376
public function set($key, $value)
    {
        if (!$value instanceof EmailBodyPart) {
            throw new InvalidArgumentException(
                sprintf(
                    '%s only accepts instances of %s. Tried to to set key %s.',
                    __FUNCTION__, EmailBodyPart::class, $key
                )
            );
        }

        parent::set($key, $value);
    }
230647
public function setValue($value)
    {
        if ((\is_scalar($value) && \is_numeric($value))) {
            $this->value = (float) $value;
        } elseif (\is_object($value) && $value instanceof self) {
            $this->value = $value->getValue();
        }

        throw new \InvalidArgumentException('Expected double');
    }
486328
public static function toByteString($value)
    {
        if (self::isStringCastable($value)) {
            return (string)$value;
        } else {
            throw new \InvalidArgumentException(ErrorMessageCreator::create($value, 'ByteString (a string)'));
        }
    }
1048722
public function isTrue($value, $message = '')
    {
        $this->assertion->setActual($value);

        return $this->assertion->to->be->true($message);
    }
76383
public static function isNullOrInstanceOf($value, $class, $message = null)
    {
        if (!is_null($value) && !$value instanceof $class) {
            throw new InvalidArgumentException(sprintf(
                $message ?: 'Expected null or instance of %2$s, but got %s',
                Helper::typeToString($value),
                $class
            ));
        }
    }
159756
public function setConfirmationType($value)
    {
        if ($value === null || $value === '') {
            $this->_confirmationTypes = null;
        } elseif (TypeCast::canCastToEnumString($value)) {
            if (!ConfirmationType::valueExists((string)$value)) {
                throw new \InvalidArgumentException('Invalid confirmation_type value: "' . $value . '"');
            }
            $this->_confirmationTypes = $value;
        } else {
            throw new \InvalidArgumentException('Invalid confirmation_type value type: "' . gettype($value) . '"');
        }
    }
1202870
public static function toFloat($value)
    {
        if (!static::is($value)) {
            throw new \InvalidArgumentException(
                "The \$value parameter must be numeric (or string representing a big number)."
            );
        }

        if (is_int($value) || is_float($value)) {
            return (float)$value;
        } else {
            return ((Str::contains($value, '.')) ? $value : $value . '.0');
        }
    }
135759
public function setValue($value)
    {
        if ((\is_bool($value))) {
            $this->value = (bool) $value;
        } elseif (\is_object($value) && $value instanceof self) {
            $this->value = $value->getValue();
        } else {
            throw new \InvalidArgumentException('Expected boolean');
        }
    }
975764
public static function assertExists($value)
    {
        if (static::exists($value) == false) {
            $class = substr(strrchr(get_called_class(), '\\'), 1);
            throw new \InvalidArgumentException(sprintf('"%s" is not a valid %s value.', $value, $class));
        }
    }
918133
protected function assertHeaderValue($value)
    {
        if (!is_string($value) && (!is_array($value) || array_product(array_map('is_string', $value)) === 0)) {
            throw new \InvalidArgumentException("Header value should be a string or an array of strings");
        }
    }