Checks whether domain reached the limit of days before expiration date and can be renewed.

@param $attribute
@return bool
335786
public function daysBeforeExpireValidator($attribute)
    {
        if (isset($this->daysBeforeExpire[$this->getZone()])) {
            $minDays = $this->daysBeforeExpire[$this->getZone()];
            $interval = (new DateTime())->diff(new DateTime($this->_model->expires));
            $diff = $interval->format('%a') - $minDays;
            if ($diff > 0) {
                $date = Yii::$app->formatter->asDate((new DateTime())->add(new \DateInterval("P{$diff}D")));
                $this->addError('id', Yii::t('hipanel:domain', 'Domains in zone {zone} could be renewed only in last {min, plural, one{# day} other{# days}} before the expiration date. You are able to renew domain {domain} only after {date} (in {days, plural, one{# day} other{# days}})', ['zone' => (string) $this->getZone(), 'min' => (int) $minDays, 'date' => (string) $date, 'days' => (int) $diff, 'domain' => (string) $this->name]));

                return false;
            }
        }

        return true;
    }
863669
public function validate($url)
    {
        $url = UrlImmutable::createFromUrl($url);

        $query = $url->getQuery();

        if ($this->isMissingAQueryParameter($query)) {
            return false;
        }

        $expiration = $query[$this->expiresParameter];

        if (!$this->isFuture($expiration)) {
            return false;
        }

        if (!$this->hasValidSignature($url)) {
            return false;
        }

        return true;
    }
1317902
public function hasChanged($attribute = false)
    {
        $changes = $this->getChanged();

        // Verificar se atributo foi alterado
        if ($attribute !== false) {
            $attribute = (array) $attribute;
            foreach ($attribute as $attr) {
                if (array_key_exists($attr, $changes)) {
                    return true;
                }
            }

            return false;
        }

        return count($changes) > 0;
    }
796060
protected function validateAttribute($object,$attribute)
	{
		$value=$object->$attribute;
		if($this->allowEmpty && $this->isEmpty($value))
			return;

		$valid=false;

		// reason of array checking is explained here: https://github.com/yiisoft/yii/issues/1955
		if(!is_array($value))
		{
			$formats=is_string($this->format) ? array($this->format) : $this->format;
			foreach($formats as $format)
			{
				$timestamp=CDateTimeParser::parse($value,$format,array('month'=>1,'day'=>1,'hour'=>0,'minute'=>0,'second'=>0));
				if($timestamp!==false)
				{
					$valid=true;
					if($this->timestampAttribute!==null)
						$object->{$this->timestampAttribute}=$timestamp;
					break;
				}
			}
		}

		if(!$valid)
		{
			$message=$this->message!==null?$this->message : Yii::t('yii','The format of {attribute} is invalid.');
			$this->addError($object,$attribute,$message);
		}
	}
1010811
public function isExpiredLink()
    {
        if (($sKey = $this->getUpdateId())) {
            $blExpired = oxNew(\OxidEsales\Eshop\Application\Model\User::class)->isExpiredUpdateId($sKey);
        }

        return $blExpired;
    }
442651
public function on($attribute)
	{
		$errors = $this->$attribute;

		return $errors && count($errors) == 1 ? $errors[0] : $errors;
	}
150383
protected function checkExpire($fileName)
    {
        if(!is_file($fileName))
        {
            return false;
        }
        $exDataFileName = $this->getExDataFileName($fileName);
        $data = unserialize(FileUtil::readFile($exDataFileName));
        if(null === $data['ttl'] ?? null)
        {
            return false;
        }
        $maxTime = time() - $data['ttl'];
        if(filemtime($fileName) <= $maxTime)
        {
            unlink($fileName);
            unlink($exDataFileName);
            return true;
        }
        else
        {
            return false;
        }
    }
127026
public function hasDirtyPreset($attribute)
    {

        // Require a previous encoding instance
        return ($encoding = $this->encoding($attribute))

            // Make sure the input actually contains a preset.  It won't in cases like
            // the AJAX PUT during listing drag and drop sorting or visibility toggle
            && ($preset_key = $this->encodingPresetInputKey($attribute))
            && request()->exists($preset_key)

            // Check if the preset has changed
            && request($preset_key) != $encoding->preset;
    }
387932
public function allowAttribute($attribute)
    {
        if (is_array($attribute))
        {
            foreach ($attribute as $attrib)
                $this->allowed_attributes[$attrib] = true;
        }
        else
            $this->allowed_attributes[$attribute] = true;
        return $this;
    }
420782
public function passwordRequirements($attribute)
    {
        if (!preg_match('~\p{Lu}~', $this->$attribute) ||
            !preg_match('~\p{Ll}~', $this->$attribute) ||
            !preg_match('~[0-9]~', $this->$attribute) ||
            mb_strlen($this->$attribute, 'UTF-8') < 6 ||
            mb_strlen($this->$attribute, 'UTF-8') > 100) {
            $this->addError($attribute, Yii::t('podium/view', 'Password must contain uppercase and lowercase letter, digit, and be at least 6 characters long.'));
        }
    }
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.'));
                }
            }
        }
    }
126801
protected function passesOptionalCheck($attribute)
	{
		if ($this->hasRule($attribute, array('Sometimes')))
		{
			return array_key_exists($attribute, array_dot($this->data))
				|| in_array($attribute, array_keys($this->data))
				|| array_key_exists($attribute, $this->files);
		}

		return true;
	}
1241700
protected function tokenExpired($token)
    {
        if (!$this->isExpirationEnabled()) {
            return false;
        }

        $expirationTime = strtotime($token['created_at']) + $this->expires;

        return $expirationTime < $this->getCurrentTime();
    }
647336
protected function shouldStopValidating($attribute)
    {
        if ($this->hasRule($attribute, ['Bail'])) {
            return $this->messages->has($attribute);
        }

        if (isset($this->failedRules[$attribute]) &&
            array_key_exists('uploaded', $this->failedRules[$attribute])) {
            return true;
        }

        // In case the attribute has any rule that indicates that the field is required
        // and that rule already failed then we should stop validation at this point
        // as now there is no point in calling other rules with this field empty.
        return $this->hasRule($attribute, $this->implicitRules) &&
               isset($this->failedRules[$attribute]) &&
               array_intersect(array_keys($this->failedRules[$attribute]), $this->implicitRules);
    }
1369000
public function validOneTimePassword($attribute, $params)
    {
        if ($this->_mode === OneTimePasswordFormBehavior::OTP_TIME) {
            $valid = $this->_authenticator->checkCode($this->_secret, $this->$attribute);
        } elseif ($this->_mode === OneTimePasswordFormBehavior::OTP_COUNTER) {
            $valid = $this->_authenticator->getCode($this->_secret, $this->getPreviousCounter()) == $this->$attribute;
        } else {
            $valid = false;
        }
        if (!$valid) {
            $this->addError($attribute, Yii::t('usr', 'Entered code is invalid.'));

            return false;
        }
        if ($this->$attribute == $this->getPreviousCode()) {
            if ($this->_mode === OneTimePasswordFormBehavior::OTP_TIME) {
                $message = Yii::t('usr', 'Please wait until next code will be generated.');
            } elseif ($this->_mode === OneTimePasswordFormBehavior::OTP_COUNTER) {
                $message = Yii::t('usr', 'Please log in again to request a new code.');
            }
            $this->addError($attribute, Yii::t('usr', 'Entered code has already been used.').' '.$message);
            $this->scenario = 'verifyOTP';

            return false;
        }

        return true;
    }
629019
public function isHashed($attribute)
    {
        if ( ! array_key_exists($attribute, $this->attributes)) {
            return false;
        }

        $info = password_get_info($this->attributes[$attribute]);

        return (bool) ($info['algo'] !== 0);
    }
397080
public function rawValueRequested($attribute)
    {
        if (strrpos($attribute, 'raw') === 0) {
            $rawAttribute = snake_case(str_replace('raw', '', $attribute));
            return $this->isTranslatable($rawAttribute);
        }
        return false;
    }