public static function maxLength($value, $maxLength, $message = null, $propertyPath = null, $encoding = 'utf8')
{
static::string($value, $message, $propertyPath);
if (mb_strlen($value, $encoding) > $maxLength) {
$message = sprintf($message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.', static::stringify($value), $maxLength, mb_strlen($value, $encoding));
$constraints = array('max_length' => $maxLength, 'encoding' => $encoding);
throw static::createException($value, $message, static::INVALID_MAX_LENGTH, $propertyPath, $constraints);
}
return true;
}