Blank example


        $this->addConstraint(new Email(['mode' => 'strict']));

        return $this;
    }

    /** * Set prop must be blank */
    public function isBlank(): self
    {
        $this->addConstraint(new Blank());

        return $this;
    }

    /** * Set prop must be in array */
    public function isInArray(array $values): self
    {
        $this->addConstraint(new Choice($values));

        

    public function __construct(private readonly ValidatorInterface $validator)
    {
    }

    /** * Default method for determining constraints when using the Symfony validator. */
    public static function loadValidatorMetadata(ClassMetadata $metadata): void
    {
        $metadata->addPropertyConstraint('honeypotValue', new Blank());
    }

    /** * {@inheritdoc} */
    public function isValid(Request $request, array $captchaConfig): bool
    {
        $this->honeypotValue = $request->get(self::CAPTCHA_REQUEST_PARAMETER, '');

        return \count($this->validator->validate($this)) < 1;
    }

    
Home | Imprint | This part of the site doesn't use cookies.