public function clientValidateAttribute($model, $attribute, $view)
{
if ($this->range instanceof \Closure) {
$this->range = call_user_func($this->range, $model, $attribute);
}
$range = [];
foreach ($this->range as $value) {
$range[] = (string) $value;
}
$options = ['range' => $range, 'not' => $this->not, 'message' => Yii::$app->getI18n()->format($this->message, ['attribute' => $model->getAttributeLabel($attribute)], Yii::$app->language)];
if ($this->skipOnEmpty) {
$options['skipOnEmpty'] = 1;
}
if ($this->allowArray) {
$options['allowArray'] = 1;
}
ValidationAsset::register($view);
return 'yii.validation.range(value, messages, ' . json_encode($options, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ');';
}