Validates the provided item create struct.

@throws \Netgen\BlockManager\Exception\Validation\ValidationException If the validation failed
164113
public function validateItemCreateStruct(ItemCreateStruct $itemCreateStruct): void
    {
        $this->validate(
            $itemCreateStruct->definition,
            [
                new Constraints\NotNull(),
                new Constraints\Type(['type' => ItemDefinitionInterface::class]),
            ],
            'definition'
        );

        if ($itemCreateStruct->value !== null) {
            $this->validate(
                $itemCreateStruct->value,
                [
                    new Constraints\Type(['type' => 'scalar']),
                ],
                'value'
            );
        }

        $this->validate(
            $itemCreateStruct,
            new ConfigAwareStructConstraint(
                [
                    'payload' => $itemCreateStruct->definition,
                ]
            )
        );
    }
235219
protected function validateInput(array $data)
    {
        $rules = (new StoreUserRequest())->rules();

        $validation = app(Factory::class)->make($data, $rules);

        if ($validation->fails()) {
            throw new ValidationException($validation->getMessageBag());
        }
    }
33896
public function validateCreateDocument()
    {
        $this->_documentMustHavePrimaryData();
        $this->_primaryDataMustHaveType();
        $this->_primaryDataMayHaveUuid();
        $this->_primaryDataMayHaveRelationships();

        if ($this->_errorCollection->count() === 0) {
            return;
        }

        throw new ValidationException($this->_getErrorCollectionEntity());
    }
728691
public function validate() {
        if ($this->initializer) {
            Ensure::isFalse($this->initializer->getRepository() && $this->initializer->getValue(), 'It makes no sense to define initializer repository and value simultaneously for column [%s]', $this->name);
        }
    }
1165983
public function validate()
	{
		$varValue = $this->getPost($this->strName);

		if (!empty($varValue) && !$this->isValidOption($varValue))
		{
			$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalid'], (is_array($varValue) ? implode(', ', $varValue) : $varValue)));
		}

		parent::validate();
	}
142553
protected function validate($value){
        if( parent::validate($value) ){
            if( $this->required && empty($value) ){
                throw new ValidateException(sprintf($this->__('Field %s is required.'), $this->label));
            }
            return true;
        }else{
            return false;
        }
    }
403183
protected function validate()
    {
        // Do not perform request validation/transformation if it is disable
        if ($this[self::DISABLE_VALIDATION]) {
            return;
        }

        $errors = array();
        $validator = $this->getValidator();
        foreach ($this->operation->getParams() as $name => $schema) {
            $value = $this[$name];
            if (!$validator->validate($schema, $value)) {
                $errors = array_merge($errors, $validator->getErrors());
            } elseif ($value !== $this[$name]) {
                // Update the config value if it changed and no validation errors were encountered
                $this->data[$name] = $value;
            }
        }

        // Validate additional parameters
        $hidden = $this[self::HIDDEN_PARAMS];

        if ($properties = $this->operation->getAdditionalParameters()) {
            foreach ($this->toArray() as $name => $value) {
                // It's only additional if it isn't defined in the schema
                if (!$this->operation->hasParam($name) && !in_array($name, $hidden)) {
                    // Always set the name so that error messages are useful
                    $properties->setName($name);
                    if (!$validator->validate($properties, $value)) {
                        $errors = array_merge($errors, $validator->getErrors());
                    } elseif ($value !== $this[$name]) {
                        $this->data[$name] = $value;
                    }
                }
            }
        }

        if (!empty($errors)) {
            $e = new ValidationException('Validation errors: ' . implode("\n", $errors));
            $e->setErrors($errors);
            throw $e;
        }
    }
226458
protected function validate_item($item) {

        $allowed = array(
            'user'              => true,
            'grouping'          => true,
            'group'             => true,
            'role'              => true,
            'file'              => true,
            'scale'             => true,
            'outcome'           => true,
            'grade_item'        => true,
            'question_category' => true
        );

        if (!isset($allowed[$item])) {
            throw new coding_exception('Invalid inforef item type');
        }
    }
540749
private function validateAddItems(Block $block, string $collectionIdentifier, $items): void
    {
        $this->validate(
            $items,
            [
                new Constraints\Type(['type' => 'array']),
                new Constraints\NotBlank(),
                new Constraints\All(
                    [
                        'constraints' => new Constraints\Collection(
                            [
                                'fields' => [
                                    'value' => [
                                        new Constraints\NotNull(),
                                        new Constraints\Type(['type' => 'scalar']),
                                    ],
                                    'value_type' => [
                                        new Constraints\NotBlank(),
                                        new Constraints\Type(['type' => 'string']),
                                    ],
                                    'position' => new Constraints\Optional(
                                        [
                                            new Constraints\NotNull(),
                                            new Constraints\Type(['type' => 'int']),
                                        ]
                                    ),
                                ],
                            ]
                        ),
                    ]
                ),
            ],
            'items'
        );

        $blockDefinition = $block->getDefinition();
        if (!$blockDefinition->hasCollection($collectionIdentifier)) {
            return;
        }

        $collectionConfig = $blockDefinition->getCollection($collectionIdentifier);

        foreach ($items as $item) {
            if (!$collectionConfig->isValidItemType($item['value_type'])) {
                throw ValidationException::validationFailed(
                    'value_type',
                    sprintf(
                        'Value type "%s" is not allowed in selected block.',
                        $item['value_type']
                    )
                );
            }
        }
    }
70060
private function validate() {
        foreach ($this->entries as $entry) {
            // first call the entry's own validation method
            // which will throw an exception if there's anything wrong
            $entry->validate();
            // now make sure that all links are in place
            foreach ($entry->links as $linkedid => $rel) {
                // the linked to entry exists
                if (!array_key_exists($linkedid, $this->entries)) {
                    $a = (object)array('rel' => $rel->type, 'to' => $linkedid, 'from' => $entry->id);
                    throw new portfolio_format_leap2a_exception('leap2a_nonexistantlink', 'portfolio', '', $a);
                }
                // and contains a link back to us
                if (!array_key_exists($entry->id, $this->entries[$linkedid]->links)) {

                }
                // we could later check that the reltypes were properly inverse, but nevermind for now.
            }
        }
    }
409755
protected function validate($field, $value, array $item_rules)
    {
        $this->preserveItem($field, $value, $item_rules);
        
        if (! array_key_exists('required', $item_rules)) {
            $item_rules['required'] = false;
        }
        
        if ($item_rules['required'] || $this->required($field, $value, $item_rules['required'])) {
            foreach ($item_rules as $rule => $satisfier) {
                $this->validateRule($this, $field, $value, $rule, $satisfier);
            }
        }
    }
501585
public function validate() {

		if ($this->getCurrency() === null) {
			throw new ValidationException("'currency' can't be null", 'currency', $this);
		}
		if ($this->getProduct() === null) {
			throw new ValidationException("'product' can't be null", 'product', $this);
		}
	}
786213
protected function _validateItem()
    {
        if ($this->valid()) {
            if ($this->hasChildren() && $this->getDirectoryValidationCallback()) {
                $this->_validate($this->getDirectoryValidationCallback());
            } elseif (is_file($this->getRealPath()) && $this->getFileValidationCallback()) {
                $this->_validate($this->getFileValidationCallback());
            }
        }
    }
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. ");
        }
    }
189306
public function validate() {
		parent::validate();

		if ($this->getName() === null) {
			throw new ValidationException("'name' can't be null", 'name', $this);
		}
		if ($this->getType() === null) {
			throw new ValidationException("'type' can't be null", 'type', $this);
		}
	}
107567
public function validate() {
    if (empty($this->fromPrefix)) {
      throw new BuildException("fromPrefix attribute is required.", $this->location);
    }

    if (empty($this->toPrefix)) {
      throw new BuildException("toPrefix attribute is required.", $this->location);
    }
  }
964439
public function validate() {

		if ($this->getExternalId() === null) {
			throw new ValidationException("'externalId' can't be null", 'externalId', $this);
		}
		if ($this->getProcessingType() === null) {
			throw new ValidationException("'processingType' can't be null", 'processingType', $this);
		}
		if ($this->getSubscription() === null) {
			throw new ValidationException("'subscription' can't be null", 'subscription', $this);
		}
	}