Performs full collection item entity validation
@param array $submitted
@param array $options
@return boolean|array
359664
public function collectionItem(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateCollectionItem();
        $this->validateBool('status');
        $this->validateWeight();
        $this->validateUrlCollectionItem();
        $this->validateCollectionCollectionItem();
        $this->validateEntityIdCollectionItem();
        $this->validateEntityCollectionItem();
        $this->validateData();

        $this->unsetSubmitted('update');
        $this->unsetSubmitted('collection');

        return $this->getResult();
    }
989081
public function createForm(array $options = array())
    {
        $options = array_merge(array('validation_groups' => $this->validationGroups), $options);
        
        return $this->formFactory->createNamed($this->name, $this->type, null, $options);
    }
528987
public function validate(array $options = [])
    {
        $options = array_replace(
            [
                'validateMinChildren'               => true,
                'validateMaxChildren'               => true,
                'validateParentMandatory'           => true,
                'validateParentMustNotBeSet'        => true
            ],
            $options
        );

        $countChildren = $this->countChildren();

        if ($options['validateMinChildren']
            && ($min = $this->getValidationConfig('minChildren')) !== null
            && $min > $countChildren
        ) {
            throw ValidationException::create(
                'Children must be, at least, ' . $min . '. Currently, node "' . $this->getId() . '" has ' .
                $countChildren . ' children.'
            );
        }

        if ($options['validateMaxChildren']
            && ($max = $this->getValidationConfig('maxChildren')) !== null
            && $max < $countChildren
        ) {
            throw ValidationException::create(
                'Children cannot exceed a maximum of ' . $max . '. Currently, node "' . $this->getId() . '" has ' .
                $countChildren . ' children.'
            );
        }

        if ($options['validateParentMandatory']
            && $this->getValidationConfig('parentMandatory')
            && $this->getParent() === null
        ) {
            throw ValidationException::create(
                'Node "' . $this->getId() . '" must have a Parent!'
            );
        }

        if ($options['validateParentMustNotBeSet']
            && $this->getValidationConfig('parentMustNotBeSet')
            && $this->getParent() !== null
        ) {
            throw ValidationException::create(
                'Node "' . $this->getId() . '" must NOT have a Parent!'
            );
        }
    }
677049
public function install(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateRequirementsInstall();

        if ($this->isError()) {
            return $this->getError();
        }

        $this->validateUserEmailInstall();
        $this->validateUserPasswordInstall();
        $this->validateStoreHostInstall();
        $this->validateStoreTitleInstall();
        $this->validateStoreBasepathInstall();
        $this->validateStoreTimezoneInstall();
        $this->validateInstallerInstall();
        $this->validateDbNameInstall();
        $this->validateDbUserInstall();
        $this->validateDbPasswordInstall();
        $this->validateDbHostInstall();
        $this->validateDbTypeInstall();
        $this->validateDbPortInstall();
        $this->validateDbConnectInstall();

        return $this->getResult();
    }
555116
public function json(array $submitted, array $options)
    {
        $options += array(
            'field' => null,
            'label' => null
        );

        $value = gplcart_array_get($submitted, $options['field']);

        json_decode($value);

        if (json_last_error() === JSON_ERROR_NONE) {
            return true;
        }

        return $this->setErrorInvalid($options['field'], $options['label']);
    }
839183
public function run($handler_id, &$submitted, array $options = array())
    {
        $result = null;
        $this->hook->attach('validator.run.before', $submitted, $options, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $result = $this->callHandler($handler_id, $submitted, $options);
        $this->hook->attach('validator.run.after', $submitted, $options, $result, $this);

        if ($result === true) {
            return true;
        }

        return empty($result) ? $this->translation->text('Failed validation') : $result;
    }
244882
function validate($value, $key, $fields, $options, $exists, \CharlotteDunois\Validation\Validator $validator) {
        if(!$exists) {
            return false;
        }
        
        if(!\is_array($value)) {
            return 'formvalidator_make_array';
        }
        
        if(!empty($options)) {
            foreach($value as $val) {
                $type = \gettype($val);
                if($type === 'double') {
                    $type = 'float'; // @codeCoverageIgnore
                }
                
                if($type !== $options) {
                    return array('formvalidator_make_array_subtype', array('{0}' => $options));
                }
            }
        }
        
        return true;
    }
1099836
public static function invoke(
        ValidationResult $validationResult,
        array $options = []
    ): ValidationResult {
        $fieldConfig = Property::getArray(
            $options,
            static::OPTION_FIELD_CONFIG
        );

        if (empty($fieldConfig)) {
            return $validationResult;
        }

        $details = $validationResult->getDetails();
        $details[static::DETAIL_FIELD_CONFIG] = $fieldConfig;

        if ($validationResult instanceof ValidationResultFields) {
            return new ValidationResultFieldsBasic(
                $validationResult->isValid(),
                $validationResult->getCode(),
                $details,
                $validationResult->getFieldResults()
            );
        }

        return new ValidationResultBasic(
            $validationResult->isValid(),
            $validationResult->getCode(),
            $details
        );
    }
125544
public function validates($entity, $options = [])
    {
        $fieldname = $this->name();

        if (!isset($entity->{$fieldname})) {
            return true;
        }
        return $entity->{$fieldname}->validates($options);
    }
663211
protected static function validateOptions(array $options = []): void
    {
        if (empty($options)) {
            return;
        }

        $validOptions = [
            'save_path',
            'name',
            'save_handler',
            'auto_start',
            'gc_probability',
            'gc_divisor',
            'gc_maxlifetime',
            'serialize_handler',
            'cookie_lifetime',
            'cookie_path',
            'cookie_domain',
            'cookie_secure',
            'cookie_httponly',
            'use_strict_mode',
            'use_cookies',
            'use_only_cookies',
            'referer_check',
            'cache_limiter',
            'cache_expire',
            'use_trans_sid',
            'trans_sid_tags',
            'trans_sid_hosts',
            'sid_length',
            'sid_bits_per_character',
            'upload_progress.enabled',
            'upload_progress.cleanup',
            'upload_progress.prefix',
            'upload_progress.name',
            'upload_progress.freq',
            'upload_progress.min_freq',
            'lazy_write',
            'read_and_close'
        ];

        $keys = \array_keys($options);
        foreach ($keys as $key) {
            if (!\in_array($key, $validOptions, true)) {
                throw new SessionException('Incorrect option: ' . $key);
            }
        }
    }
153573
public function priceRule(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validatePriceRule();
        $this->validateName();
        $this->validateWeight();
        $this->validateBool('status');
        $this->validateUsedPriceRule();
        $this->validateTriggerPriceRule();
        $this->validateCurrencyPriceRule();
        $this->validateValueTypePriceRule();
        $this->validateCodePriceRule();
        $this->validateValuePriceRule();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
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();
    }
636383
public function country(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateCountry();
        $this->validateWeight();
        $this->validateBool('status');
        $this->validateCodeCountry();
        $this->validateName();
        $this->validateNativeNameCountry();
        $this->validateZoneCountry();
        $this->validateFormatCountry();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
689870
public function zone(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateZone();
        $this->validateBool('status');
        $this->validateTitle();

        $this->unsetSubmitted('update');

        return $this->getResult();
    }
602582
protected function checkRequiredOptions(array $options)
    {
        array_walk(
            $this->supportedOptions,
            function ($supportedOptionData, $supportedOptionName, $options) {
                if (isset($supportedOptionData[1])
                    && true === $supportedOptionData[1]
                    && empty($supportedOptionData[0])
                    && !array_key_exists($supportedOptionName, $options)
                ) {
                    throw new InvalidServiceOptionsException(
                        'Required validation option not set: ' . $supportedOptionName,
                        1456397839
                    );
                }
            },
            $options
        );
    }
813976
public function length(array $submitted, array $options)
    {
        $options += array(
            'field' => null,
            'label' => null,
            'arguments' => array()
        );

        $value = gplcart_array_get($submitted, $options['field']);

        list($min, $max) = $options['arguments'] + array(1, 255);

        $length = mb_strlen($value);

        if ($min <= $length && $length <= $max) {
            return true;
        }

        return $this->setErrorLengthRange($options['field'], $options['label'], $min, $max);
    }
1079875
public function validate($data, $mode, array $options = [])
    {
        $errors = [];

        // implements something cleaner later
        if (ValidatorProvider::UPDATE === $mode && !isset($data['id'])) {
            return $errors;
        }

        // validates the resource type exists
        if ($data['meta'] && $data['meta']['type']) {
            $resourceType = $this->om
                ->getRepository('ClarolineCoreBundle:Resource\ResourceType')
                ->findOneBy(['name' => $data['meta']['type']]);

            if (!$resourceType) {
                $errors[] = [
                    'path' => 'meta/type',
                    'message' => sprintf('The type %s does not exist.', $data['meta']['type']),
                ];
            }
        }

        return $errors;
    }