EqualToValidator.php 770 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Constraints;
  11. /**
  12. * Validates values are equal (==).
  13. *
  14. * @author Daniel Holmes <daniel@danielholmes.org>
  15. * @author Bernhard Schussek <bschussek@gmail.com>
  16. */
  17. class EqualToValidator extends AbstractComparisonValidator
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. protected function compareValues($value1, $value2)
  23. {
  24. return $value1 == $value2;
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. protected function getErrorCode()
  30. {
  31. return EqualTo::NOT_EQUAL_ERROR;
  32. }
  33. }