protected function validateValue($value)
{
if (!is_string($value)) {
return [$this->message, []];
}
$length = mb_strlen($value, $this->encoding);
if ($this->min !== null && $length < $this->min) {
return [$this->tooShort, ['min' => $this->min]];
}
if ($this->max !== null && $length > $this->max) {
return [$this->tooLong, ['max' => $this->max]];
}
if ($this->length !== null && $length !== $this->length) {
return [$this->notEqual, ['length' => $this->length]];
}
return null;
}