Configure the validator instance.

@param \Illuminate\Validation\Validator $validator

@return void
342657
public function withValidator($validator): void
    {
        $credentials = $this->only('email', 'expiration', 'token');
        $passwordResetBroker = app('auth.password')->broker($this->route('passwordResetBroker'));

        $validator->after(function ($validator) use ($passwordResetBroker, $credentials) {
            if (! ($user = $passwordResetBroker->getUser($credentials))) {
                $validator->errors()->add('email', trans('cortex/auth::'.PasswordResetBrokerContract::INVALID_USER));
            }

            if ($user && ! $passwordResetBroker->validateToken($user, $credentials)) {
                $validator->errors()->add('email', trans('cortex/auth::'.PasswordResetBrokerContract::INVALID_TOKEN));
            }

            if (! $passwordResetBroker->validateTimestamp($credentials['expiration'])) {
                $validator->errors()->add('email', trans('cortex/auth::'.PasswordResetBrokerContract::EXPIRED_TOKEN));
            }
        });
    }
1055382
public function addValidator(callable $validator, string $validator_name): self
    {
        $this->validators[$validator_name] = $validator;

        return $this;
    }
21154
public function validate($validator)
    {
        // Validate currency
        $currencies = $this->getAllowedCurrencies();
        $currency = $this->fieldCurrency->dataValue();
        if ($currency && $currencies && !in_array($currency, $currencies)) {
            $validator->validationError(
                $this->getName(),
                _t(
                    __CLASS__ . '.INVALID_CURRENCY',
                    'Currency {currency} is not in the list of allowed currencies',
                    ['currency' => $currency]
                )
            );
            return false;
        }

        // Field-specific validation
        return $this->fieldAmount->validate($validator) && $this->fieldCurrency->validate($validator);
    }
278242
public function setValidator(\chilimatic\lib\interfaces\IFlyWeightValidator $validator)
    {
        $this->validator = $validator;

        return $this;
    }
1149898
protected function failedValidation(Validator $validator)
    {
        if ($this->isApiRequest()) {
            throw new ValidationException($validator, $this->getErrorCodes());
        }

        parent::failedValidation($validator);
    }
847970
final protected function runExtendedScenario(Validator $validator): void
    {
        if (\is_null($method = $this->validationScenarios['extend'])) {
            return;
        }

        $this->{$method}($validator);
    }
365749
protected function _setValidator($validator)
    {
        if (!is_null($validator) && !($validator instanceof ValidatorInterface)) {
            throw $this->_createInvalidArgumentException($this->__('Invalid validator'), null, null, $validator);
        }

        $this->validator = $validator;
    }
633819
public function validate($validator)
    {
        if (!$this->config()->get( 'enabled')) {
            return true;
        }

        if (!$this->isCorrectAnswer($this->Value())) {
            $validator->validationError(
                $this->name,
                _t(
                    'MathSpamProtectionField.INCORRECTSOLUTION',
                    "Incorrect solution to the spam protection question, please try again."
                ),
                "error"
            );

            return false;
        }

        return true;
    }
233143
public function validationPasswordReset(Validator $validator) {
		return $this->validateOldPassword($validator)
			->validatePassword($validator)
			->validateConfirmPassword($validator);
	}
1269298
public function validator($type, $validator)
    {
        $this->validators[$type] = $validator;

        $this->resolver($type, function ($data, $resourceId) use ($type) {
            /** @var \Drp\JsonApiParser\Contracts\ValidatorExecutor[] $validators */
            $validators = Arr::wrap($this->validators[$type]);

            foreach ($validators as $validator) {
                $data['id'] = $resourceId;
                $validator->with($data);

                $result = $validator->passes();

                if (!$result) {
                    $errors = $validator->errors();

                    $types = explode('.', $type);
                    $key = end($types);

                    if ($resourceId !== null) {
                        $key .= '_' . $resourceId;
                    }

                    $this->errors[$key] = array_merge(Arr::get($this->errors, $key, []), $errors);
                }
            }
        });

        return $this;
    }
1291870
private static function checkValidator($validator)
    {
        if (!array_key_exists($validator, self::$validators)) {
            return self::checkClass($validator);
        }
        return self::$validators[$validator];
    }
221024
public function setValidator($validator)
    {
        $this->callBeforeListeners('setValidator', [$validator]);
        $this->validator = $validator;
        $this->callAfterListeners('setValidator', [$validator]);
    }
337711
public function validationDefault(Validator $validator)
    {
        $validator
            ->notEmpty('handler', __d('field', 'Invalid field type.'))
            ->add('label', [
                'notBlank' => [
                    'rule' => 'notBlank',
                    'message' => __d('field', 'You need to provide a label.'),
                ],
                'length' => [
                    'rule' => ['minLength', 3],
                    'message' => __d('field', 'Label need to be at least 3 characters long'),
                ],
            ]);

        return $validator;
    }
322219
public function validate(Validator $validator = null)
    {
        if (null === $validator) {
            $validator = new Validator(new ClassMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory(), new DefaultTranslator());
        }

        $failureMap = new ConstraintViolationList();

        if (!$this->alreadyInValidation) {
            $this->alreadyInValidation = true;
            $retval = null;


            $retval = $validator->validate($this);
            if (count($retval) > 0) {
                $failureMap->addAll($retval);
            }

            if (null !== $this->collAttributeAttributeTypes) {
                foreach ($this->collAttributeAttributeTypes as $referrerFK) {
                    if (method_exists($referrerFK, 'validate')) {
                        if (!$referrerFK->validate($validator)) {
                            $failureMap->addAll($referrerFK->getValidationFailures());
                        }
                    }
                }
            }
            if (null !== $this->collAttributeTypeI18ns) {
                foreach ($this->collAttributeTypeI18ns as $referrerFK) {
                    if (method_exists($referrerFK, 'validate')) {
                        if (!$referrerFK->validate($validator)) {
                            $failureMap->addAll($referrerFK->getValidationFailures());
                        }
                    }
                }
            }

            $this->alreadyInValidation = false;
        }

        $this->validationFailures = $failureMap;

        return (Boolean) (!(count($this->validationFailures) > 0));

    }
1309498
public function setValidator(Validator $validator)
    {
        if ($validator) {
            $this->validator = $validator;
            $this->validator->setForm($this);
        }
        return $this;
    }
548953
public function validationDefault(Validator $validator)
    {
        $validator
            ->uuid('id')
            ->allowEmpty('id', 'create');

        $validator
            ->requirePresence('name', 'create')
            ->notEmpty('name');

        $validator
            ->allowEmpty('color');

        $validator
            ->allowEmpty('icon');

        $validator
            ->allowEmpty('source');

        return $validator;
    }
1202754
public function validate(Validator $validator)
    {
        $handler = $this->get('metadata')->get('handler');
        if (class_exists($handler)) {
            $handler = new $handler();

            return $handler->validate($this, $validator);
        }
    }