Validates the specified attribute
@param string $attribute
@return bool
552844
protected function validateAttribute (string $attribute=NULL) : bool
	{
		if (!property_exists($this, $attribute))
		{
			$this->error = "Attribute: ".ucfirst($attribute)." is not a class object.";
        	return FALSE;
		}
        $result = (is_array($this->$attribute)) ? !empty($this->$attribute) : Validate::hasValue($this->$attribute);
        if ($result) return TRUE;
		$this->error = "Set ".ucfirst($attribute)." to log your message.";
    	return FALSE;
	}
381539
public function validateEmail($attribute, $value)
    {
        if (! is_string($value) && ! (is_object($value) && method_exists($value, '__toString'))) {
            return false;
        }

        return (new EmailValidator)->isValid($value, new RFCValidation);
    }
929260
public function attr($attribute)
    {
        if (strpos($attribute, ':') !== false) {
            list($ns, $attribute) = explode(':', $attribute, 2);

            return trim((string) $this->el->attributes($ns, true)->{$attribute});
        }
        return trim((string) $this->el->attributes()->{$attribute});
    }
1290727
public function isEncrypted($attribute)
    {
        if ( ! array_key_exists($attribute, $this->attributes)) {
            return false;
        }

        try {
            $this->decrypt(array_get($this->attributes, $attribute));
        } catch (DecryptException $exception) {
            return false;
        }

        return true;
    }
1028283
protected function validateRequired($attribute, $value)
	{
		if (is_null($value))
		{
			return false;
		}
		elseif (is_string($value) && trim($value) === '')
		{
			return false;
		}
		elseif ($value instanceof File)
		{
			return (string) $value->getPath() != '';
		}

		return true;
	}
944909
protected function validateAttribute($object, $attribute)
    {
        $value = $object->{$attribute};
        if ($this->isEmpty($value)) {
            $this->validateEmpty($object, $attribute);
            return;
        }
        if (!is_numeric($value)) {
            $message = $this->message !== null ? $this->message : '"{attribute}"必须是数字';
            $this->addError($object, $attribute, $message);
            return;
        }
        if ($this->integerOnly) {
            if (!preg_match($this->integerPattern, "$value")) {
                $message = $this->message !== null ? $this->message : '"{attribute}"必须是整数';
                $this->addError($object, $attribute, $message);
                return;
            }
        } else if (!preg_match($this->numberPattern, "$value")) {
            $message = null !== $this->message ? $this->message : '"{attribute}"必须是数字';
            $this->addError($object, $attribute, $message);
            return;
        }
        if (null !== $this->min && $value < $this->min) {
            $this->addError($object, $attribute, $this->tooSmallMessage, ['{min}' => $this->min]);
            return;
        }
        if (null !== $this->max && $value > $this->max) {
            $this->addError($object, $attribute, $this->tooBigMessage, ['{max}' => $this->max]);
        }
    }
1365203
public function validateAttribute($model, $attribute)
    {
        $this->_model = $model;
        $this->_attributeName = $attribute;
        $result = $this->validateValue($model->$attribute);
        if (!empty($result)) {
            $this->addError($model, $attribute, $result[0], $result[1]);
        }
    }
77029
protected function validateTituloEleitor($attribute, $value)
    {

        $input = preg_replace('/[^\d]/', '', $value);

        $uf = substr($input, -4, 2);

        if (((strlen($input) < 5) || (strlen($input) > 13)) || 
        (str_repeat($input[1], strlen($input)) == $input) || 
        ($uf < 1 || $uf > 28)) {
            return false;
        }

        $dv = substr($input, -2);
        $base = 2;

        $sequencia = substr($input, 0, -4);

        for ($i = 0; $i < 2; $i++) { 
            $fator = 9;
            $soma = 0;

            for ($j = (strlen($sequencia) - 1); $j > -1; $j--) { 
                $soma += $sequencia[$j] * $fator;

                if ($fator == $base) {
                    $fator = 10;
                }

                $fator--;
            }

            $digito = $soma % 11;

            if (($digito == 0) and ($uf < 3)) {
                $digito = 1;
            } elseif ($digito == 10) {
                $digito = 0;
            }
            
            if ($dv[$i] != $digito) {
                return false;
            }

            switch ($i) {
                case '0':
                    $sequencia = $uf . $digito;

                    break;
            }
        }
        
        return true;
    }
950047
public function validateUrl ($attribute)
		{
			if (!$this->hasErrors())
			{
				if (filter_var($this->$attribute, FILTER_VALIDATE_URL) === false)
					$this->addError($attribute, Yii::tr('{attribute} is not a valid URL.', [ 'attribute' => $this->name ], 'setting'));
			}
		}
964902
private function getAttributeId($attribute)
    {
        $attributeId = $attribute;

        if (is_object($attribute)) {
            $attributeId = $attribute->getAttributeId();
        }

        return $attributeId;
    }
837960
protected function validateInteger( $attribute, $value )
	{
		if ( !$this->hasAttribute( $attribute ) )
		{
			return true;
		}

		return is_null( $value ) || filter_var( $value, FILTER_VALIDATE_INT ) !== false;
	}
956251
public function validatePassword($attribute)
    {
        if (!$this->hasErrors()) {
            $user = $this->user;
            if (empty($user) || !$user->validatePassword($this->password)) {
                $this->addError($attribute, 'Incorrect username or password.');
            }
        }
    }
821615
public function confirmationValidate($attribute)
    {
        if (!$this->hasErrors()) {
            if ($this->user !== null) {
                $confirmationRequired = Yii::$app->settings->get('enableConfirmation', 'user') && !Yii::$app->settings->get('enableUnconfirmedLogin', 'user');
                if ($confirmationRequired && !$this->user->isEmailConfirmed) {
                    $this->addError($attribute, Yii::t('yuncms', 'You need to confirm your email address.'));
                }
                if ($this->user->isBlocked) {
                    $this->addError($attribute, Yii::t('yuncms', 'Your account has been blocked.'));
                }
            }
        }
    }
45472
protected function validateAttribute($object, $attribute)
    {
        $value = $object->{$attribute};
        if ($this->isEmpty($value)) {
            $this->validateEmpty($object, $attribute);
            return;
        }
        if (!$this->validateValue($value)) {
            $this->addError($object, $attribute, $this->message);
        }
    }
827619
public function validatePhones($attribute)
    {
        $items = $this->$attribute;

        if (!is_array($items)) {
            $items = [];
        }

        $multiple = true;
        if(!is_array($items)) {
            $multiple = false;
            $items = (array) $items;
        }

        foreach ($items as $index => $item) {
            $validator = new NumberValidator();
            $error = null;
            $validator->validate($item, $error);
            if (!empty($error)) {
                $key = $attribute . ($multiple ? '[' . $index . ']' : '');
                $this->addError($key, $error);
            }
        }
    }
417443
public function behaviorValidator($attribute, $params)
    {
        $behavior = $params['behavior'];
        $validator = $params['validator'];
        unset($params['behavior']);
        unset($params['validator']);
        if (($behavior = $this->getBehavior($behavior)) !== null) {
            return $behavior->{$validator}($attribute, $params);
        }

        return true;
    }
1120122
protected function validateAttribute($attribute, $rule)
    {
        $this->currentRule = $rule;

        [$rule, $parameters] = ValidationRuleParser::parse($rule);

        if ($rule == '') {
            return;
        }

        // First we will get the correct keys for the given attribute in case the field is nested in
        // an array. Then we determine if the given rule accepts other field names as parameters.
        // If so, we will replace any asterisks found in the parameters with the correct keys.
        if (($keys = $this->getExplicitKeys($attribute)) &&
            $this->dependsOnOtherFields($rule)) {
            $parameters = $this->replaceAsterisksInParameters($parameters, $keys);
        }

        $value = $this->getValue($attribute);

        // If the attribute is a file, we will verify that the file upload was actually successful
        // and if it wasn't we will add a failure for the attribute. Files may not successfully
        // upload if they are too large based on PHP's settings so we will bail in this case.
        if ($value instanceof UploadedFile && ! $value->isValid() &&
            $this->hasRule($attribute, array_merge($this->fileRules, $this->implicitRules))
        ) {
            return $this->addFailure($attribute, 'uploaded', []);
        }

        // If we have made it this far we will make sure the attribute is validatable and if it is
        // we will call the validation method with the attribute. If a method returns false the
        // attribute is invalid and we will add a failure message for this failing attribute.
        $validatable = $this->isValidatable($rule, $attribute, $value);

        if ($rule instanceof RuleContract) {
            return $validatable
                    ? $this->validateUsingCustomRule($attribute, $value, $rule)
                    : null;
        }

        $method = "validate{$rule}";

        if ($validatable && ! $this->$method($attribute, $value, $parameters, $this)) {
            $this->addFailure($attribute, $rule, $parameters);
        }
    }