public function validate($value, &$error = null)
    {
        $result = $this->validateValue($value);
        if (empty($result)) {
            return true;
        }

        list($message, $params) = $result;
        $params['attribute'] = Yii::t('yii', 'the input value');
        $params['value'] = is_array($value) ? 'array()' : $value;
        $error = Yii::$app->getI18n()->format($message, $params, Yii::$app->language);

        return false;
    }
public function validate($value, &$error = null)
    {
        $result = $this->validateValue($value);
        if (empty($result)) {
            return true;
        }

        list($message, $params) = $result;
        $params['attribute'] = Yii::t('yii', 'the input value');
        $params['value'] = is_array($value) ? 'array()' : $value;
        $error = Yii::$app->getI18n()->format($message, $params, Yii::$app->language);

        return false;
    }
public function validate ( $ value , & $ error = null ) { $ result = $ this -> validateValue ( $ value ) ; if ( empty ( $ result ) ) { return true ; } list ( $ message , $ params ) = $ result ; $ params [ 'attribute' ] = Yii :: t ( 'yii' , 'the input value' ) ; $ params [ 'value' ] = is_array ( $ value ) ? 'array()' : $ value ; $ error = Yii :: $ app -> getI18n ( ) -> format ( $ message , $ params , Yii :: $ app -> language ) ; return false ; }
Validates a given value.
You may use this method to validate a value out of the context of a data model.
@param mixed $value the data value to be validated.
@param string $error the error message to be returned, if the validation fails.
@return boolean whether the data is valid.
Validates a given value . You may use this method to validate a value out of the context of a data model .