Checks if the passed value is valid.
@api
mixed $value The value that should be validated:
Constraint $constraint The constraint for the validation:
Overrides ConstraintValidatorInterface::validate
public function validate($value, Constraint $constraint) {
  if (!$this
    ->compareValues($value, $constraint->value, $constraint)) {
    $this->context
      ->addViolation($constraint->message, array(
      '{{ value }}' => $this
        ->valueToString($constraint->value),
      '{{ compared_value }}' => $this
        ->valueToString($constraint->value),
      '{{ compared_value_type }}' => $this
        ->valueToType($constraint->value),
    ));
  }
}