public static function length($value, $length, $message = null, $propertyPath = null, $encoding = 'utf8')
{
static::string($value, $message, $propertyPath);
if (mb_strlen($value, $encoding) !== $length) {
$message = sprintf($message ?: 'Value "%s" has to be %d exactly characters long, but length is %d.', static::stringify($value), $length, mb_strlen($value, $encoding));
$constraints = array('length' => $length, 'encoding' => $encoding);
throw static::createException($value, $message, static::INVALID_LENGTH, $propertyPath, $constraints);
}
return true;
}