* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; /** * @author Bernhard Schussek */ class TypeValidator extends ConstraintValidator { /** * {@inheritdoc} */ public function validate($value, Constraint $constraint) { if (!$constraint instanceof Type) { throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Type'); } if (null === $value) { return; } $type = strtolower($constraint->type); $type = 'boolean' == $type ? 'bool' : $constraint->type; $isFunction = 'is_'.$type; $ctypeFunction = 'ctype_'.$type; if (function_exists($isFunction) && $isFunction($value)) { return; } elseif (function_exists($ctypeFunction) && $ctypeFunction($value)) { return; } elseif ($value instanceof $constraint->type) { return; } $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ type }}', $constraint->type) ->setCode(Type::INVALID_TYPE_ERROR) ->addViolation(); } } __halt_compiler();----SIGNATURE:----iI31wt8WwlAJKi7GrLy0riOlqDPMrmSBJads8ElYTOJslRp4qG6L6y8HbkQDC5VIRpUg8sL3AtmQ7dmeVnp6DYrU4cdnOqp3wxjZCshHTQx9CMHtUogjXGDtrVBSb/UBr2CcPJlLY7Ni1WwSOAAsKv4zkAQDhaUedjIyTlI8Gsj28RHukFPeWm80ymhK7ksbc6DoiRSJ55tWjqpqbsRCTbqusXRQEvqlQ/UXlDIFz1C4CHabxZNtk2r2/clYQv5kNxdULZi8u7OTj4N3j+N8QV/z7APl2NoMXOflFxObNog84wUPsMWgvf1NyoM+3g0jfhCwEM6mv/Fx3FRN/iVBOiTx96Nxhq2WYCDWHq5vnx7z8flzrNup6KXIqbuQd32s2B5GqeFFk6d9fo3g7kY8hMGtsJE88MzADam/+z2Ff+ziB8jo50SUAM4aB2tFgO15rsmK63BN+9+pa0JeP+892EYFB7pBbgkrcBfbQseu7sywtSYUyoVJwx6VTfqYiFSNbUTxZFfj6TQ6HBxjHE1OcHaff3xeGG/TMvHlZ2wegnFZ/HqkaIwOgHbRzUU7x7hV/aM602SGXMt0NZ7QQsbL+elN/vM+yVxn40ViSjjbKVemD+KMi2icX6qli4aL8uTzF5z23gZ6KeYFSmoV8w5mBU/jyTxZF2F3KyLXIWBusgM=----ATTACHMENT:----MjQ4NzUxNjQ0NzM2Nzg2MyAzNDc4NDA4Mzc4NTg0MTY3IDI5OTQzNTAyMjUyOTM2