Validates the model and settings if showTree is used
@return void
427924
public function validateTree()
    {
        if (!$this->showTree) {
            return;
        }

        $this->showSorting = $this->showPagination = false;

        if (!$this->model->methodExists('getChildren')) {
            throw new ApplicationException(
                'To display list as a tree, the specified model must have a method "getChildren"'
            );
        }

        if (!$this->model->methodExists('getChildCount')) {
            throw new ApplicationException(
                'To display list as a tree, the specified model must have a method "getChildCount"'
            );
        }
    }
372033
public function validate()
    {
        /* @var $model \yii\db\ActiveRecord */
        $valid = true;

        foreach ($this->_relationsToSave as $model) {
            $model->{$this->relPrimaryKey} = ($this->owner->primaryKey) ? $this->owner->primaryKey : null;

            $attributes = array_diff($model->activeAttributes(), [$this->relPrimaryKey]);

            if (!$model->validate($attributes)) {
                $this->owner->addErrors($model->getErrors());

                $valid = false;
            }
        }

        return $valid;
    }
973706
public function validateModelClass()
    {
        if ($this->isReservedKeyword($this->modelClass)) {
            $this->addError('modelClass', 'Class name cannot be a reserved PHP keyword.');
        }
        if ((empty($this->tableName) || substr_compare($this->tableName, '*', -1, 1)) && $this->modelClass == '') {
            $this->addError('modelClass', 'Model Class cannot be blank if table name does not end with asterisk.');
        }
    }
1162518
protected function validate()
    {
        if ($this->descriptor === null || $this->scripts === null || $this->package === null) {
            throw new BuildException(
                'The deployment tool needs at least the project descriptor, '
                . 'the scripts folder and package folder to be set.'
            );
        } elseif ($this->lint !== false && $this->phpbin === null) {
            throw new BuildException('You set the lint option but not the path to the php executable.');
        }

        parent::validate();

        if ($this->lint !== false) {
            $this->arguments .= '--lint ';
        }

        if ($this->source !== null) {
            $this->arguments .= "--src-dir=$this->source ";
        }

        if ($this->output !== null) {
            $this->arguments .= "--output-dir=$this->output ";
        }

        if ($this->phpbin !== null) {
            $this->arguments .= "--php-exe=$this->phpbin ";
        }

        $this->arguments .= "--scripts-dir=$this->scripts ";
        $this->arguments .= "--package-descriptor=$this->descriptor ";
        $this->arguments .= $this->package;
    }
1246312
protected function validate()
    {
        foreach ($this->_requiredAttr as $attr) {
            if (is_array($attr)) {
                $valid = false;
                foreach ($attr as $sub) {
                    if (!is_null($this->$sub)) {
                        $valid = true;
                        break;
                    }
                }
                if (!$valid) {
                    return false;
                }
            } elseif (is_null($this->$attr)) {
                return false;
            }
        }
        return true;
    }
115534
protected function validateConfig()
    {
        $this->queueDriver = $this->createQueueDriver();
        $this->requiredFields = $this->queueDriver->getRequiredConfig();
        $this->config = array_merge($this->queueDriver->getDefaultConfig(), $this->config);
        parent::validateConfig();
    }
720902
protected function _validateLoadable() {
        if ($this->_loadable) {
            return true;
        }
        if (!class_exists('Model_Snippet')) {
            throw new Exception(
                'The Snippet model could not be autoloaded. Spawn it first, dumbass!'
            );
        }
        $this->_loadable = true;
        return $this->_loadable;
    }
1182862
public function validateTemplate()
    {
        $templates = $this->templates;
        if (!isset($templates[$this->template])) {
            $this->addError('template', 'Invalid template selection.');
        } else {
            $templatePath = $this->templates[$this->template];
            foreach ($this->requiredTemplates() as $template) {
                if (!is_file(Yii::getAlias($templatePath . '/' . $template))) {
                    $this->addError('template', "Unable to find the required code template file '$template'.");
                }
            }
        }
    }
1238868
private function validate()
    {
        if (empty($this->modelName) && empty($this->model)) {
            throw new Exception\ModelNotSetException();
        }

        if (empty($this->model)) {
            $this->model = new $this->modelName();
        }

        if (empty($this->modelName)) {
            $this->modelName = get_class($this->model);
        }

        if (empty($this->db)) {
            $this->db = $this->model->getConnection();
        }
    }
449574
public function calculateAllTrees()
    {
        $fields = $this->formObject->getConfiguration()->getFields();

        foreach ($fields as $field) {
            $this->getActivationConditionTreeForField($field);

            foreach ($field->getValidation() as $validation) {
                $this->getActivationConditionTreeForValidation($validation);
            }
        }
    }
1359351
protected function validateModel()
    {
        parent::validateModel();

        $table = $this->getTable();

        // Check to see whether any generated foreign key names
        // will conflict with column names.

        $colPhpNames = array();
        $fkPhpNames = array();

        foreach ($table->getColumns() as $col) {
            $colPhpNames[] = $col->getPhpName();
        }

        foreach ($table->getForeignKeys() as $fk) {
            $fkPhpNames[] = $this->getFKPhpNameAffix($fk, $plural = false);
        }

        $intersect = array_intersect($colPhpNames, $fkPhpNames);
        if (!empty($intersect)) {
            throw new EngineException("One or more of your column names for [" . $table->getName() . "] table conflict with foreign key names (" . implode(", ", $intersect) . ")");
        }

        // Check foreign keys to see if there are any foreign keys that
        // are also matched with an inversed referencing foreign key
        // (this is currently unsupported behavior)
        // see: http://trac.propelorm.org/ticket/549

        foreach ($table->getForeignKeys() as $fk) {
            if ($fk->isMatchedByInverseFK()) {
                throw new EngineException("The 1:1 relationship expressed by foreign key " . $fk->getName() . " is defined in both directions; Propel does not currently support this (if you must have both foreign key constraints, consider adding this constraint with a custom SQL file.)");
            }
        }
    }
400262
public function verifySettings()
    {
        if ($this->type === null) {
            $this->setError("The type attribute is required");
        } elseif (!in_array($this->type, self::$types, true)) {
            $this->setError("Invalid type specified; must be one of (" . implode(self::$types) . ")");
        }
    }
332618
protected function validateModel()
    {
        $model = $this->controller->reorderGetModel();
        $modelTraits = class_uses($model);

        if (isset($modelTraits[\October\Rain\Database\Traits\Sortable::class])) {
            $this->sortMode = 'simple';
        }
        elseif (isset($modelTraits[\October\Rain\Database\Traits\NestedTree::class])) {
            $this->sortMode = 'nested';
            $this->showTree = true;
        }
        else {
            throw new ApplicationException('The model must implement the NestedTree or Sortable traits.');
        }

        return $model;
    }
1193134
public function validate() : void
    {
        if (null === $this->is_valid) {
            if (null === $this->user_value && null !== $this->default_value) {
                // There is a preset value, and its not being changed
                $this->is_valid = true;
            } elseif (true == $this->user_value || 1 == $this->user_value) {
                $this->user_value = 1;
                $this->is_valid = true;
            } elseif (false == $this->user_value || 0 == $this->user_value || '' == $this->user_value) {
                $this->user_value = 0;
                $this->is_valid = true;
            } elseif (false == $this->validator) {
                // This field does not get validated
                $this->is_valid = true;
            } else {
                $this->is_valid = false;
                $this->error = 'The provided value is not valid. Please enter a valid value.';
            }
        }

        // Check if the input is different from the default value
        if ($this->is_valid && null !== $this->user_value) {
            $this->is_changed = ($this->default_value != $this->user_value);
        }
    }
335134
final public function validate(): bool
    {
        // validate csrf token if required
        if ($this->_tokenRequired && !$this->_tokenOk) {
            App::$Session->getFlashBag()->add('warning', __('Hack attention: security token is wrong!'));
            return false;
        }
        // get all rules as array from method rules()
        $rules = $this->rules();
        // get default values of attributes
        $defaultAttr = $this->getAllProperties();

        // start validation: on this step class attribute values will be changed to input data if it valid
        $success = $this->runValidate($rules);

        // get not-passed validation fields as array
        $badAttributes = $this->getBadAttributes();
        // prevent warnings
        if (Any::isArray($badAttributes) && count($badAttributes) > 0) {
            foreach ($badAttributes as $attr) {
                if (Str::contains('.', $attr)) { // sounds like dot-separated array attr
                    $attrName = strstr($attr, '.', true); // get attr name
                    $attrArray = trim(strstr($attr, '.'), '.'); // get dot-based array path

                    $defaultValue = new DotData($defaultAttr); // load default attr

                    $dotData = new DotData($this->{$attrName}); // load local attr variable
                    $dotData->set($attrArray, $defaultValue->get($attr)); // set to local prop. variable default value

                    $this->{$attrName} = $dotData->export(); // export to model
                } else {
                    $this->{$attr} = $defaultAttr[$attr]; // just set ;)
                }
                // add message about wrong attribute to session holder, later display it
                $attrLabel = $attr;
                if ($this->getLabel($attr) !== null) {
                    $attrLabel = $this->getLabel($attr);
                }

                App::$Session->getFlashBag()->add('warning', __('Field "%field%" is incorrect', ['field' => $attrLabel]));
            }
        }

        return $success;
    }
811494
protected function validateEditUserRole()
    {
        $this->setSubmitted('role');
        $this->setSubmittedBool('status');
        $this->setSubmitted('update', $this->data_role);

        if (!$this->getSubmitted('permissions')) {
            $this->setSubmitted('permissions', array());
        }

        $this->validateComponent('user_role');

        return !$this->hasErrors();
    }
52668
public function validate() {
        $validated = TRUE;

        foreach($this->getFormElements() as $name => $child) {
            $validated &= $child->validate();
        }

        $validated &= $this->fireEvent("Form\onValidate", [ $this->value, $this ], TRUE, FALSE);

        return (bool)$validated;
    }