EqualToValidator.php 770 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. }