Advances the owners state if possible

@param bool $runValidation if set to true, the owner will be validated before saving
@return bool true if ok, false if something went wrong
167159
public function checkAndAdvanceState($runValidation=true)
	{
		$transaction = Yii::$app->db->beginTransaction();

		while ($this->hasNextState()) {
			if ($this->advanceOneState(false)) {
				if (!$this->saveStateAttribute($runValidation)) {
					$transaction->rollBack();
					return false;
				}
			} else {
				break;
			}
		}

		$transaction->commit();
		return true;
	}
271849
protected function run_validation($vars)
	{
		if ( ! isset(static::$_rules) or count(static::$_rules) < 0)
		{
			return true;
		}

		$this->_validation = $this->validation();

		return $this->_validation->run($vars);
	}
1117778
public function validateGhost($form, $initialize = true)
    {
        if ($initialize) {
            $this->initializeValidator($form);
        }

        $this->isValid($form);

        return $this->result;
    }
510687
public function runValidators()
	{
		$filelistValidator = new FileListValidator($this->input, $this->output);

		$validateFiles = $filelistValidator->setSource($this->sourceIso, $this->sourcePath, $this->sourceLanguagePath)
			->setOrigin($this->originIso, $this->originPath, $this->originLanguagePath)
			->setPhpbbVersion($this->phpbbVersion)
			->setDebug($this->debug)
			->setSafeMode($this->safeMode)
			->validate();

		if (empty($validateFiles))
		{
			$this->output->writelnIfDebug('');
			$this->output->writelnIfDebug("<fatal>No files found for validation.</fatal>");
			return;
		}

		$pluralRule = $this->guessPluralRule();
		$this->output->writelnIfDebug("<notice>Using plural rule #$pluralRule for validation.</notice>");
		$this->output->writelnIfDebug('');

		$this->output->writelnIfDebug("Validating file list:");
		$this->printErrorLevel($this->output);

		$this->maxProgress = sizeof($validateFiles) + 1;
		$this->progressLength = 11 + strlen($this->maxProgress) * 2;

		$filelistValidator = new FileValidator($this->input, $this->output);
		$filelistValidator->setSource($this->sourceIso, $this->sourcePath, $this->sourceLanguagePath)
			->setOrigin($this->originIso, $this->originPath, $this->originLanguagePath)
			->setPhpbbVersion($this->phpbbVersion)
			->setPluralRule($pluralRule)
			->setDebug($this->debug)
			->setSafeMode($this->safeMode);

		foreach ($validateFiles as $sourceFile => $originFile)
		{
			$this->output->writelnIfDebug('');
			$this->output->writelnIfDebug("Validating file: $originFile");
			$filelistValidator->validate($sourceFile, $originFile);
			$this->printErrorLevel($this->output);

			usleep(31250);//125000);
		}

		$this->output->writeln('.');
	}
464939
private function isValid($forceValidate)
    {
        if ($this->storage->exists() && $this->resources->isValid($this->storage->getLastWriteTime())) {
            return ($forceValidate || $this->isDebugging()) ? $this->validateManifest() : true;
        }

        return false;
    }
1207663
public function beforeValidate($event)
    {
        parent::beforeValidate($event);
        if ($this->owner->hasAttribute($this->statusAttribute) && !isset($this->owner->{$this->statusAttribute})) {
            $this->owner->{$this->statusAttribute} = $this->defaultStatus;
        }
    }
689785
public function save($runValidation = true, $attributeNames = null)
    {
        $transaction = static::getDb()->beginTransaction();
        try {

            if ($this->getIsNewRecord()) {
                $migrationType = self::MIGRATION_INSTALL;
                $result = $this->insert($runValidation, $attributeNames);
            } else {
                $migrationType = self::MIGRATION_UPGRADE;
                $result = $this->update($runValidation, $attributeNames) !== false;
            }
            if ($result !== false && $this->migration) {
                $result = $this->migration($migrationType);
            }

            if ($result === false) {
                $transaction->rollBack();
            } else {
                $transaction->commit();

                static::updateCache();
            }
            return $result;
        } catch (\Exception $e) {
            $transaction->rollBack();
            throw $e;
        }
    }
910836
def validate_owner
      # If there is an unambigous owner, then we are done.
      return unless owner.nil?
      # If there is more than one owner attribute, then check that there is at most one
      # unambiguous owner reference. The owner method returns nil if the owner is ambiguous.
      if self.class.owner_attributes.size > 1 then
        vh = value_hash(self.class.owner_attributes)
        if vh.size > 1 then
          raise ValidationError.new("Dependent #{self} references multiple owners #{vh.pp_s}:\n#{dump}")
        end
      end
      # If there is an owner reference attribute, then there must be an owner.
      if self.class.bidirectional_java_dependent? then
        raise ValidationError.new("Dependent #{self} does not reference an owner")
      end
    end
677450
private function validate()
    {
        if (!class_exists($this->class)) {
            throw new \RuntimeException(sprintf('Class %s does not exist, is this the correct namespace?', $this->class));
        }
        if (!in_array($this->method, get_class_methods($this->class))) {
            throw new \RuntimeException(sprintf('The method "%s" does not exist in "%s" class.', $this->method, $this->class));
        }
    }
942167
public function validate(ValidationResult $validationResult) {
        if (!$this->owner->ID) return; // The object is new, won't be looping.
        if (!$this->owner->LanguageID) return; // The object has no parent, won't be looping.
        if (!$this->owner->isChanged('LanguageID')) return; // The parent has not changed, skip the check for performance reasons.

        // Walk the hierarchy upwards until we reach the top, or until we reach the originating node again.
        $node=$this->owner;
        while($node) {
            if ($node->LanguageID==$this->owner->ID) {
                // Hierarchy is looping.
                $validationResult->error(
                    _t(
                        'Hierarchy.InfiniteLoopNotAllowed',
                        'Infinite loop found within the "{type}" hierarchy. Please change the parent to resolve this',
                        'First argument is the class that makes up the hierarchy.',
                        array('type' => $this->owner->class)
                    ),
                    'INFINITE_LOOP'
                );
                break;
            }
            $node=$node->LanguageID ? $node->Language() : null;
        }

        // At this point the $validationResult contains the response.
    }
180803
public static function create(array $attributes, $runValidation = true)
    {
        $model = new static();
        $model->load($attributes, '');
        if ($model->save($runValidation)) {
            return $model;
        }
        return null;
    }
771704
public static function isValid($value)
    {
        if (__CLASS__ === get_called_class()) {
            throw new \RuntimeException('Cannot call isValid() on ' . __CLASS__);
        }

        $reflectionClass = new \ReflectionClass(get_called_class());
        $validValues = $reflectionClass->getConstants();

        if (static::isBitFlag()) {
            $bitFlagAllOn = 0;

            foreach ($validValues as $validValue) {
                $bitFlagAllOn |= $validValue;
            }

            return ($value | $bitFlagAllOn) === $bitFlagAllOn;
        }

        return in_array($value, $validValues, true);
    }
817176
protected function validateEditUser()
    {
        $this->setSubmitted('user');
        $this->setSubmittedBool('status');
        $this->setSubmitted('update', $this->data_user);

        $this->validateComponent('user', array('admin' => $this->access('user_edit')));

        return !$this->hasErrors();
    }
1299700
public function isValid($value = null, array $chain = []): bool
    {
        $this->parseChain($chain);

        if (empty($this->chain)) {
            throw new RuntimeException('No validators found in chain');
        }

        $this->results = [];
        $isValid = true;
        foreach ($this->chain as $name => $validator) {
            $result = $validator->isValid($value);
            $this->errors[$name] = $validator->getErrors();
            if ($result === true) {
                $this->results[$name] = true;
            } else {
                $this->results[$name] = false;
                $isValid = false;
            }
        }

        return $isValid;
    }
366716
public static function isValid($validator, $value)
    {
        /** @var ValidatorInterface $validator */
        $validator = static::create($validator);
        $result = $validator->isValid($value);
        static::$_messages = $validator->getMessages();
        return $result;
    }
584283
protected function validateOwner()
    {
        if (0 == ($valueLength = strlen($this->owner->getValue()))) {
            return true;
        }

        $allowedLength = $this->getConfig();
        if (is_scalar($allowedLength)) {
            return $valueLength == $allowedLength;
        } else {
            return (empty($allowedLength['min']) || $valueLength >= $allowedLength['min']) &&
                   (empty($allowedLength['max']) || $valueLength <= $allowedLength['max']);
        }
    }
764101
public function isValid()
    {
        try {
            $this->validateName($this->name);
            $this->validateValue($this->value);
            $this->validateMaxAge($this->maxAge);
        } catch (\InvalidArgumentException $e) {
            return false;
        }

        return true;
    }