public function validateAttribute($model, $attribute)
{
$value = $model->{$attribute};
if (is_array($value)) {
$this->addError($model, $attribute, Yii::t('yii', '{attribute} is invalid.'));
return;
}
if ($this->compareValue !== null) {
$compareLabel = $compareValue = $compareValueOrAttribute = $this->compareValue;
} else {
$compareAttribute = $this->compareAttribute === null ? $attribute . '_repeat' : $this->compareAttribute;
$compareValue = $model->{$compareAttribute};
$compareLabel = $compareValueOrAttribute = $model->getAttributeLabel($compareAttribute);
}
if (!$this->compareValues($this->operator, $this->type, $value, $compareValue)) {
$this->addError($model, $attribute, $this->message, ['compareAttribute' => $compareLabel, 'compareValue' => $compareValue, 'compareValueOrAttribute' => $compareValueOrAttribute]);
}
}