@@ -116,19 +116,19 @@ public function validateAttribute($model, $attribute)
116
116
protected function validateValue ($ value )
117
117
{
118
118
if (is_array ($ value ) && !$ this ->allowArray ) {
119
- return [Yii:: t ( ' yii ' , ' {attribute} is invalid. ' ) , []];
119
+ return [$ this -> message , []];
120
120
}
121
121
$ values = !is_array ($ value ) ? [$ value ] : $ value ;
122
- foreach ($ values as $ value ) {
123
- if ($ this ->isNotNumber ($ value )) {
124
- return [Yii:: t ( ' yii ' , ' {attribute} is invalid. ' ) , []];
122
+ foreach ($ values as $ sample ) {
123
+ if ($ this ->isNotNumber ($ sample )) {
124
+ return [$ this -> message , []];
125
125
}
126
126
$ pattern = $ this ->integerOnly ? $ this ->integerPattern : $ this ->numberPattern ;
127
- if (!preg_match ($ pattern , StringHelper::normalizeNumber ($ value ))) {
127
+ if (!preg_match ($ pattern , StringHelper::normalizeNumber ($ sample ))) {
128
128
return [$ this ->message , []];
129
- } elseif ($ this ->min !== null && $ value < $ this ->min ) {
129
+ } elseif ($ this ->min !== null && $ sample < $ this ->min ) {
130
130
return [$ this ->tooSmall , ['min ' => $ this ->min ]];
131
- } elseif ($ this ->max !== null && $ value > $ this ->max ) {
131
+ } elseif ($ this ->max !== null && $ sample > $ this ->max ) {
132
132
return [$ this ->tooBig , ['max ' => $ this ->max ]];
133
133
}
134
134
}
0 commit comments