vendor/excelwebzone/recaptcha-bundle/src/Validator/Constraints/IsTrue.php line 12

Open in your IDE?
  1. <?php
  2. namespace EWZ\Bundle\RecaptchaBundle\Validator\Constraints;
  3. use Symfony\Component\Validator\Constraint;
  4. /**
  5. * @Annotation
  6. * @Target("PROPERTY")
  7. */
  8. #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::IS_REPEATABLE)]
  9. class IsTrue extends Constraint
  10. {
  11. public $message = 'This value is not a valid captcha.';
  12. public $invalidHostMessage = 'The captcha was not resolved on the right domain.';
  13. public function __construct(array $options = null, string $message = null, string $invalidHostMessage = null, array $groups = null, $payload = null)
  14. {
  15. parent::__construct($options ?? [], $groups, $payload);
  16. $this->message = $message ?? $this->message;
  17. $this->invalidHostMessage = $invalidHostMessage ?? $this->invalidHostMessage;
  18. }
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function getTargets(): string
  23. {
  24. return Constraint::PROPERTY_CONSTRAINT;
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function validatedBy(): string
  30. {
  31. return 'ewz_recaptcha.true';
  32. }
  33. }