Performs basic validation of config structure. This method is to be overridden by custom implementations if
required

@throws InvalidConfigException
@throws InvalidApiClassException
180730
protected function assertConfigIsValid(): void
    {
        foreach ($this->configProperties as $property) {
            if (empty(self::$config[$this->configSectionName][$property])) {
                throw new InvalidConfigException(
                    sprintf(
                        "Config section does not exist or is not filled properly: %s (\"%s\" is missing)",
                        $this->configSectionName,
                        $property
                    )
                );
            }
        }

        $this->assertApiClassImplementsInterface($this->apiInterface);
    }
1221387
public void validate() throws GridConfigurationException {
    // validations occur here in the getters called on the configuration.
    try {
      configuration.getHubHost();
      configuration.getHubPort();
    } catch (RuntimeException e) {
      throw new GridConfigurationException(e.getMessage());
    }
  }
508232
public function validate() {

		if ($this->getFieldName() === null) {
			throw new ValidationException("'fieldName' can't be null", 'fieldName', $this);
		}
		if ($this->getSorting() === null) {
			throw new ValidationException("'sorting' can't be null", 'sorting', $this);
		}
	}
1008564
protected function validateOptions()
    {
        if (!isset($this->options['allowedTypes'])) {
            throw new InvalidValidationOptionsException('The option "allowedTypes" was not specified.', 1327947194);
        } elseif (!is_array($this->options['allowedTypes']) || $this->options['allowedTypes'] === []) {
            throw new InvalidValidationOptionsException('The option "allowedTypes" must be an array with at least one item.', 1327947224);
        }
    }
855541
protected function initOptions()
    {
        if (!($this->model instanceof Model)) {
            throw new InvalidConfigException('Model is required');
        }

        if (!($this->model->getPrimaryKey())) {
            throw new InvalidConfigException('Model has empty primary key');
        }

        if ($this->button !== false) {
            $this->button['position'] = isset($this->button['position']) ? $this->button['position'] : static::BUTTON_OUTSIDE;
        }

        if (empty($this->scenario)) {
            $this->scenario = $this->model->scenario;
        } else {
            $this->_oldScenario = $this->model->scenario;
            $this->model->scenario = $this->scenario;
        }

        if ($this->form !== false) {
            $formConfig = [
                'method' => 'POST',
                'action' => $this->scenario,
                'options' => [
                    'class' => 'inline',
                    'data' => [
                        'modal-form' => true,
                    ],
                ],
            ];
            if ($this->submit === static::SUBMIT_PJAX) {
                $formConfig['options'] = ArrayHelper::merge($formConfig['options'], [
                    'data' => ['pjax' => 1, 'pjax-push' => 0],
                ]);
            } elseif ($this->submit === static::SUBMIT_AJAX) {
                $formConfig['options'] = ArrayHelper::merge($formConfig['options'], [
                    'data' => ['ajax-submit' => 1],
                ]);

                $this->registerAjaxSubmit();
            }

            $this->form = ArrayHelper::merge($formConfig, $this->form);
        }

        if (is_array($footer = $this->modal['footer'])) {
            $tag = ArrayHelper::remove($footer, 'tag', 'input');
            $label = ArrayHelper::remove($footer, 'label', 'OK');
            $footer = ArrayHelper::merge([
                'data-modal-submit' => true,
                'data-loading-text' => '<i class="fa fa-circle-o-notch fa-spin"></i> ' . Yii::t('hipanel', 'loading'),
            ], $footer);

            if ($tag === 'input') {
                $footer['type']  = 'submit';
                $footer['value'] = $label;
            }

            $this->modal['footer'] = Html::tag($tag, $label, $footer);
            $this->registerFooterButtonScript();
        }

        $this->modal = ArrayHelper::merge([
            'id' => $this->getModalId(),
            'toggleButton' => ($this->button['position'] === static::BUTTON_IN_MODAL) ? $this->button : false,
        ], $this->modal);
    }
726387
protected function performValidation()
    {
        $this->requireProperties(['name', 'in']);
        if ($this->in === 'path') {
            $this->requireProperties(['required']);
            if (!$this->required) {
                $this->addError("Parameter 'required' must be true for 'in': 'path'.");
            }
        }
        if (!empty($this->content) && !empty($this->schema)) {
            $this->addError("A Parameter Object MUST contain either a schema property, or a content property, but not both. ");
        }
    }
910848
protected function checkConditionConfiguration()
    {
        $configuration = $this->formObject->getConfiguration();

        if (false === $configuration->hasField($this->fieldName)) {
            throw InvalidConditionException::conditionFieldCountValuesFieldNotFound($this->fieldName);
        }
    }
1250815
def validate_config!
      VALIDATABLE_ATTRIBUTES.each do |attr|
        klass = CONFIG_ATTRIBUTES_TO_HEADER_CLASSES[attr]
        klass.validate_config!(instance_variable_get("@#{attr}"))
      end
    end
184296
protected function validateModel()
    {
        if (!is_string($this->model)) {
            $baseName = $this->getControllerBaseName();
            $this->findModelClass($baseName);
        }
    }
1318585
public function isValid()
    {
        $data = $this->toArray();

        $missing = array_diff(self::$REQUIRED_FIELDS, array_keys($data));

        if ($missing) {
            throw new \InvalidArgumentException('Config is missing the following keys: ' . implode(', ', $missing));
        }

        return true;
    }
708577
public function verifySettings()
    {
        // Creation is done here rather than in isSelected() because some
        // containers may do a validation pass before running isSelected(),
        // but we need to check for the existence of the created class.
        if ($this->dynselector === null) {
            $this->selectorCreate();
        }

        if (empty($this->classname)) {
            $this->setError("The classname attribute is required");
        } elseif ($this->dynselector === null) {
            $this->setError("Internal Error: The custom selector was not created");
        } elseif (!($this->dynselector instanceof ExtendFileSelector) && (count($this->parameters) > 0)) {
            $this->setError(
                "Cannot set parameters on custom selector that does not "
                . "implement ExtendFileSelector."
            );
        }
    }
1136194
protected function initMethods()
    {
        if (empty($this->methods)) {
            return;
        }

        if (!is_array($this->methods)) {
            throw new InvalidConfigException('The "methods" option are not an array');
        }

        foreach ($this->methods as $methodName => $handler) {
            $function = $handler instanceof JsExpression ? $handler : new JsExpression($handler);
            $this->clientOptions['methods'][$methodName] = $function;
        }
    }
1138386
public function init()
    {
        parent::init();

        if (empty($this->model)) {
            throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "model" property must be set.'));
        }

        if (empty($this->pjaxContainerId)) {
            $this->pjaxContainerId = 'comment-pjax-container-' . $this->getId();
        }

        if (empty($this->model->{$this->entityIdAttribute})) {
            throw new InvalidConfigException(Yii::t('yii2mod.comments', 'The "entityIdAttribute" value for widget model cannot be empty.'));
        }

        $this->entity = hash('crc32', get_class($this->model));
        $this->entityId = $this->model->{$this->entityIdAttribute};

        if (empty($this->relatedTo)) {
            $this->relatedTo = get_class($this->model) . ':' . $this->entityId;
        }

        $this->encryptedEntity = $this->getEncryptedEntity();
        $this->commentWrapperId = $this->entity . $this->entityId;

        $this->registerAssets();
    }
80425
public function init()
	{
		if (!in_array($this->extension, static::$ALLOWED_EXTENSIONS)) {
			$msg = Yii::t('app', 'Illegal extension {ext}, only these are allowed: {allowed}', [
				'ext'=>$this->extension,
				'allowed'=>implode(', ', static::$ALLOWED_EXTENSIONS),
			]);
			throw new InvalidConfigException($msg);
		}
	}
480549
protected function setUp(): void
    {
        parent::setUp();

        $this->invalidStructure = [
            T_ARRAY => [T_OPEN_PARENTHESIS, T_CLOSE_PARENTHESIS],
            T_OPEN_SHORT_ARRAY => [T_CLOSE_SHORT_ARRAY]
        ];
    }
495967
private void setupData(ValidationConfig config, ClassLoader classLoader) {
        // A config object is always used to use a common code path, so the parsed
        // ValidationConfig may be null if a validation.xml wasn't found.
        if (config != null) {
            versionID = config.getVersionID();

            defaultProvider = config.getDefaultProvider();
            defaultProvider = defaultProvider != null ? defaultProvider.trim() : defaultProvider;

            messageInterpolator = config.getMessageInterpolator();
            messageInterpolator = messageInterpolator != null ? messageInterpolator.trim() : messageInterpolator;

            traversableResolver = config.getTraversableResolver();
            traversableResolver = traversableResolver != null ? traversableResolver.trim() : traversableResolver;

            constraintMapping = config.getConstraintMappings();

            constraintValidatorFactory = config.getConstraintValidatorFactory();
            constraintValidatorFactory = constraintValidatorFactory != null ? constraintValidatorFactory.trim() : constraintValidatorFactory;

            properties = config.getProperties();
        }
        appClassloader = classLoader;
    }
579819
@Override
    public void basicValidate(final String section) throws ConfigException {
        if (StringUtils.isEmpty(host) || port == null || port <= 0 || port > MAX_PORT) {
            throw new ConfigException(section, "Invalid host and port");
        }
    }