/home/techb158/immovalet.com/vendor/sendgrid/sendgrid/lib/helper
Edit: /home/techb158/immovalet.com/vendor/sendgrid/sendgrid/lib/helper/Assert.php (9937B)
$size) {
$message = sprintf(
$message ?: 'Number of elements in "$%s" can not be more than %d.',
$property,
$size
);
throw new TypeException($message);
}
}
/**
* Assert that number of elements in array is more than a given limit.
*
* @param mixed $value
* @param string $property
* @param int $size
* @param string|null $message
*
* @throws TypeException
*/
public static function minItems($value, $property, $size, $message = null)
{
static::isArray($value, $property, $message);
if (\count($value) < $size) {
$message = sprintf(
$message ?: 'Number of elements in "$%s" can not be less than %d.',
$property,
$size
);
throw new TypeException($message);
}
}
/**
* Assert that a number is smaller as a given limit.
*
* @param mixed $value
* @param string $property
* @param int $limit
* @param string|null $message
*
* @throws TypeException
*/
public static function maxValue($value, $property, $limit, $message = null)
{
static::integer($value, $property, $message);
$limit = (int) $limit;
if ($value > $limit) {
$message = sprintf(
$message ?: '"$%s" expected to be at most %d. Got: %s',
$property,
$limit,
$value
);
throw new TypeException($message);
}
}
/**
* Assert that a number is at least as big as a given limit.
*
* @param mixed $value
* @param string $property
* @param int $limit
* @param string|null $message
*
* @throws TypeException
*/
public static function minValue($value, $property, $limit, $message = null)
{
static::integer($value, $property, $message);
$limit = (int) $limit;
if ($value < $limit) {
$message = sprintf(
$message ?: '"$%s" expected to be at least %d. Got: %s',
$property,
$limit,
$value
);
throw new TypeException($message);
}
}
/**
* Assert that string value is not longer than a given limit.
*
* @param mixed $value
* @param string $property
* @param int $limit
* @param string|null $message
*
* @throws TypeException
*/
public static function maxLength($value, $property, $limit, $message = null)
{
static::string($value, $property, $message);
$length = mb_strlen($value, 'utf8');
if ($length > $limit) {
$message = sprintf(
$message ?: '"$%s" must have no more than %d characters. Got: %d',
$property,
$limit,
$length
);
throw new TypeException($message);
}
}
/**
* Assert that string value length is greater than a given limit.
*
* @param mixed $value
* @param string $property
* @param int $limit
* @param string|null $message
*
* @throws TypeException
*/
public static function minLength($value, $property, $limit, $message = null)
{
static::string($value, $property, $message);
$length = mb_strlen($value, 'utf8');
if ($length < $limit) {
$message = sprintf(
$message ?: '"$%s" must have at least %d characters. Got: %d',
$property,
$limit,
$length
);
throw new TypeException($message);
}
}
/**
* Assert that value is in array of choices.
*
* @param mixed $value
* @param string $property
* @param array $choices
* @param string|null $message
*
* @throws TypeException
*/
public static function anyOf($value, $property, array $choices, $message = null)
{
if (!\in_array($value, $choices, true)) {
$message = sprintf(
$message ?: '"$%s" must be any of "%s". Got: %s',
$property,
implode(', ', $choices),
$value
);
throw new TypeException($message);
}
}
}