@see \eZ\Publish\Core\FieldType\FieldType::validateFieldSettings()

@param mixed $fieldSettings

@return \eZ\Publish\SPI\FieldType\ValidationError[]
327359
public function validateFieldSettings($fieldSettings)
    {
        $validationErrors = array();

        foreach ($fieldSettings as $name => $value) {
            if (!isset($this->settingsSchema[$name])) {
                $validationErrors[] = new ValidationError(
                    "Setting '%setting%' is unknown",
                    null,
                    array(
                        '%setting%' => $name,
                    ),
                    "[$name]"
                );
                continue;
            }

            switch ($name) {
                case 'selectionMethod':
                    if (!$this->isValidSelectionMethod($value)) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' must be one of %selection_browse%, %selection_dropdown%, %selection_list_with_radio_buttons%, %selection_list_with_checkboxes%, %selection_multiple_selection_list%, %selection_template_based_multiple%, %selection_template_based_single%",
                            null,
                            array(
                                '%setting%' => $name,
                                '%selection_browse%' => self::SELECTION_BROWSE,
                                '%selection_dropdown%' => self::SELECTION_DROPDOWN,
                                '%selection_list_with_radio_buttons%' => self::SELECTION_LIST_WITH_RADIO_BUTTONS,
                                '%selection_list_with_checkboxes%' => self::SELECTION_LIST_WITH_CHECKBOXES,
                                '%selection_multiple_selection_list%' => self::SELECTION_MULTIPLE_SELECTION_LIST,
                                '%selection_template_based_multiple%' => self::SELECTION_TEMPLATE_BASED_MULTIPLE,
                                '%selection_template_based_single%' => self::SELECTION_TEMPLATE_BASED_SINGLE,
                            ),
                            "[$name]"
                        );
                    }
                    break;
                case 'selectionDefaultLocation':
                    if (!is_int($value) && !is_string($value) && $value !== null) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value must be of either null, string or integer",
                            null,
                            array(
                                '%setting%' => $name,
                            ),
                            "[$name]"
                        );
                    }
                    break;
                case 'selectionContentTypes':
                    if (!is_array($value)) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value must be of array type",
                            null,
                            array(
                                '%setting%' => $name,
                            ),
                            "[$name]"
                        );
                    }
                    break;
                case 'selectionLimit':
                    if (!is_int($value)) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value must be of integer type",
                            null,
                            array(
                                '%setting%' => $name,
                            ),
                            "[$name]"
                        );
                    }
                    if ($value < 0) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value cannot be lower than 0",
                            null,
                            array(
                                '%setting%' => $name,
                            ),
                            "[$name]"
                        );
                    }
                    break;
            }
        }

        return $validationErrors;
    }
536775
protected function validateTypeExtensions(array $typeExtensions)
    {
        foreach ($typeExtensions as $key => $val) {
            if (!is_string($key)) {
                throw new Exception\InvalidArgumentException(
                    'Keys of $typeExtensions array must be strings.'
                );
            }
            if (!is_array($val)) {
                throw new Exception\InvalidArgumentException(
                    'Each item of $typeExtensions array must be array of BlockTypeExtensionInterface.'
                );
            }
            foreach ($val as $subVal) {
                if (!$subVal instanceof BlockTypeExtensionInterface) {
                    throw new Exception\InvalidArgumentException(
                        'Each item of $typeExtensions[] array must be BlockTypeExtensionInterface.'
                    );
                }
            }
        }
    }
859505
public function validate($inputs)
    {
        if (empty($this->rules)) {
            throw new \RuntimeException('You must set rules for validator.');
            return false;
        }

        if (empty($inputs)) {
            throw new \RuntimeException('Empty array passed to validate method');
        }

        $this->validator($inputs)->addRule();

        if (!$this->run()) {
            $this->setErrors($this->validation->getErrors());

            return false;
        }

        return true;
    }
711181
protected function parseModuleSettings($moduleSettings)
    {
        $settings = [];

        if (is_array($moduleSettings)) {
            foreach ($moduleSettings as $setting) {
                $settings[] = $setting['name'];
            }
        }

        return $settings;
    }
551295
public function validateFieldSettings($fieldSettings)
    {
        $validationErrors = array();

        foreach ($fieldSettings as $name => $value) {
            if (!isset($this->settingsSchema[$name])) {
                $validationErrors[] = new ValidationError(
                    "Setting '%setting%' is unknown",
                    null,
                    array(
                        '%setting%' => $name,
                    ),
                    "[$name]"
                );
                continue;
            }

            switch ($name) {
                case 'defaultType':
                    $definedTypes = array(
                        self::DEFAULT_EMPTY,
                        self::DEFAULT_CURRENT_DATE,
                    );
                    if (!in_array($value, $definedTypes, true)) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' is of unknown type",
                            null,
                            array(
                                '%setting%' => $name,
                            ),
                            "[$name]"
                        );
                    }
                    break;
            }
        }

        return $validationErrors;
    }
720308
public function setValidationProperty(array $properties)
    {
        if (Helpers::isKeyExists($properties, 'validation')) {
            $this->validationRules = is_array($properties['validation']) ? $properties['validation'] : Helpers::removeEmptyItems(explode('|', $properties['validation']));
        }

        if (Helpers::isNewerThanOrEqualTo('5.2') && $this->isNullable() && !in_array('nullable', $this->validationRules)) {
            $this->validationRules[] = 'nullable';
        }

        if ($this->isBoolean() && !in_array('boolean', $this->validationRules)) {
            $this->validationRules[] = 'boolean';
        }

        if ($this->isFile() && !in_array('file', $this->validationRules)) {
            $this->validationRules[] = 'file';
        }
        if ($this->isMultipleAnswers() && !in_array('array', $this->validationRules)) {
            $this->validationRules[] = 'array';
        }

        if (in_array($this->getEloquentDataMethod(), ['char', 'string']) && in_array($this->htmlType, ['text', 'textarea'])) {
            if (!in_array('string', $this->validationRules)) {
                $this->validationRules[] = 'string';
            }

            if (!Helpers::inArraySearch($this->validationRules, 'min')) {
                $this->validationRules[] = sprintf('min:%s', $this->getMinLength());
            }

            if (!Helpers::inArraySearch($this->validationRules, 'max') && !is_null($this->getMaxLength())) {
                $this->validationRules[] = sprintf('max:%s', $this->getMaxLength());
            }
        }

        $params = [];

        if (Helpers::isKeyExists($properties, 'data-type-params')) {
            $params = $this->getDataTypeParams((array) $properties['data-type-params']);
        }

        if ($this->htmlType == 'number' || (in_array($this->getEloquentDataMethod(), ['decimal', 'double', 'float'])
            && isset($params[0]) && ($length = intval($params[0])) > 0
            && isset($params[1]) && ($decimal = intval($params[1])) > 0)) {
            if (!in_array('numeric', $this->validationRules)) {
                $this->validationRules[] = 'numeric';
            }

            if (!Helpers::inArraySearch($this->validationRules, 'min') && !is_null($minValue = $this->getMinValue())) {
                $this->validationRules[] = sprintf('min:%s', $minValue);
            }

            if (!Helpers::inArraySearch($this->validationRules, 'max') && !is_null($maxValue = $this->getMaxValue())) {
                $this->validationRules[] = sprintf('max:%s', $maxValue);
            }
        }

        return $this;
    }
536890
public function setFieldsWithValues(array $fieldsValues)
    {
        $this->supports = [];
        $this->values = [];

        foreach ($fieldsValues as $field => $value) {
            if (is_int($field)) {
                $field = $value;
                $value = null;
            }

            $this->supports[ ] = $field;
            if (!is_null($value)) {
                $this->values[ $field ] = $value;
            }
        }

        return $this;
    }
703564
public function setRules(array $rules): void
    {
        foreach ($rules as $key => $fields) {
            foreach ($fields as $fieldName => $fieldOptions) {
                // nested?
                @ $fieldType = $fieldOptions['type'];
                if ($fieldType == self::TYPE_ARRAY) {
                    @ $fieldSpec = $fieldOptions['spec'];
                    if (empty($fieldSpec)) {
                        throw new ValidationException(
                            "For array types, 'spec' field must be a non-empty array (field: {$fieldName})");
                    }
                    foreach ((array) $fieldSpec as $fieldSpecFieldName => $fieldSpecFieldOptions) {
                        $this->rules[$key][$fieldName][$fieldSpecFieldName] = new ValidationRule(
                            $fieldSpecFieldName, $fieldSpecFieldOptions
                        );
                    }
                } else {
                    $this->rules[$key][$fieldName] = new ValidationRule($fieldName, $fieldOptions);
                }
            }
        }
    }
1070478
public function setSettings( $settings )
    {
        if ( ! empty( $settings ) )
        {
            foreach ( $settings as $name => $value )
            {
                $this->setSetting( $name, $value );
            }
        }

        return $this;
    }
770851
public function injectSettings(array $settings)
    {
        $this->settings = $settings['persistence'];
        if (!is_array($this->settings['backendOptions'])) {
            throw new InvalidConfigurationException(sprintf('The Neos.Flow.persistence.backendOptions settings need to be an array, %s given.', gettype($this->settings['backendOptions'])), 1426149224);
        }
        if (!is_array($this->settings['doctrine']['secondLevelCache'])) {
            throw new InvalidConfigurationException(sprintf('The TYPO3.Flow.persistence.doctrine.secondLevelCache settings need to be an array, %s given.', gettype($this->settings['doctrine']['secondLevelCache'])), 1491305513);
        }
    }
188257
private function formatPreApprovalPaymentMethodData(array $paymentSettings)
    {
        $this->senderInfo['phone'] = [
            'areaCode' => $this->senderInfo['senderAreaCode'],
            'number'   => $this->senderInfo['senderPhone'],
        ];

        $this->creditCardHolder['phone'] = [
            'areaCode' => $this->creditCardHolder['creditCardHolderAreaCode'],
            'number'   => $this->creditCardHolder['creditCardHolderPhone'],
        ];

        $this->creditCardHolder['billingAddress'] = $this->billingAddress;

        if (!empty($this->senderInfo['senderCPF'])) {
            $this->senderInfo['documents'][0] = [
                'type'  => 'CPF',
                'value' => $this->senderInfo['senderCPF'],
            ];

            unset($this->senderInfo['senderCPF']);
        } else {
            $this->senderInfo['documents'][0] = [
                'type'  => 'CNPJ',
                'value' => $this->senderInfo['senderCNPJ'],
            ];

            unset($this->senderInfo['senderCNPJ']);
        }

        $this->creditCardHolder['documents'][0] = [
            'type'  => 'CPF',
            'value' => $this->creditCardHolder['creditCardHolderCPF'],
        ];

        unset($this->creditCardHolder['creditCardHolderCPF']);
        unset($this->senderInfo['senderAreaCode']);
        unset($this->senderInfo['senderPhone']);
        unset($this->creditCardHolder['creditCardHolderAreaCode']);
        unset($this->creditCardHolder['creditCardHolderPhone']);

        $data = [
            'type'          => $this->type,
            'sender'        => [
                'ip'         => $this->senderInfo['ip'],
                'hash'       => $this->senderInfo['hash'],
            ],
            'creditCard'    => [
                'token'          => $paymentSettings['creditCardToken'],
                'holder'         => $this->creditCardHolder,
            ],
        ];

        return $data;
    }
632388
public function validate(PluginBundleInterface $plugin)
    {
        $validationErrors = [];

        foreach ($this->checkers as $checker) {
            if (null !== $errors = $checker->check($plugin, $this->isInUpdateMode())) {
                $validationErrors = array_merge($validationErrors, $errors);
                continue;
            }

            if ($checker instanceof ConfigurationChecker) {
                $this->pluginConfiguration = $checker->getProcessedConfiguration();
            }
        }

        return $validationErrors;
    }
1369569
protected function validateConfig(TwitterAuthSettings $settings) {
    $consumer_key = $settings->getConsumerKey();
    $consumer_secret = $settings->getConsumerSecret();

    if (!$consumer_key || !$consumer_secret) {
      $this->loggerFactory
        ->get('social_auth_twitter')
        ->error('Define Consumer Key and Consumer Secret on module settings.');

      return FALSE;
    }

    return TRUE;
  }
980536
public function getValidator(array $locales=[]) {
		$validator = $this->getDefinition()->getEntityManager()->createValidator();
		return $this->prepareValidator($validator, $locales);
	}
693267
public function validateSettings(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateInitialPathSettings();
        $this->validateLimitSettings();
        $this->validateAccessSettings();
        $this->validateExtensionSettings();
        $this->validateFileSizeSettings();

        return $this->getResult();
    }
46983
protected function validateConfig(FacebookAuthSettings $settings) {
    $app_id = $settings->getAppId();
    $app_secret = $settings->getAppSecret();
    $graph_version = $settings->getGraphVersion();

    if (!$app_id || !$app_secret || !$graph_version) {
      $this->loggerFactory
        ->get('social_auth_facebook')
        ->error('Define App ID and App Secret on module settings.');

      return FALSE;
    }

    return TRUE;
  }
15085
public function validate($fields = null)
    {
        $this->_di->modelsValidator->validate($this, $fields ?: $this->getChangedFields());
    }