File "IsTrueValidator.php"
Full Path: /home/warrior1/public_html/wp-content-20241001222009/plugins/mailpoet/vendor-prefixed/symfony/validator/Constraints/IsTrueValidator.php
File size: 795 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace MailPoetVendor\Symfony\Component\Validator\Constraints;
if (!defined('ABSPATH')) exit;
use MailPoetVendor\Symfony\Component\Validator\Constraint;
use MailPoetVendor\Symfony\Component\Validator\ConstraintValidator;
use MailPoetVendor\Symfony\Component\Validator\Exception\UnexpectedTypeException;
class IsTrueValidator extends ConstraintValidator
{
public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof IsTrue) {
throw new UnexpectedTypeException($constraint, IsTrue::class);
}
if (null === $value) {
return;
}
if (\true !== $value && 1 !== $value && '1' !== $value) {
$this->context->buildViolation($constraint->message)->setParameter('{{ value }}', $this->formatValue($value))->setCode(IsTrue::NOT_TRUE_ERROR)->addViolation();
}
}
}