Luhn.php 1.0 KB

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. use Symfony\Component\Validator\Constraint;
  12. /**
  13. * Metadata for the LuhnValidator.
  14. *
  15. * @Annotation
  16. * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
  17. *
  18. * @author Tim Nagel <t.nagel@infinite.net.au>
  19. * @author Greg Knapp http://gregk.me/2011/php-implementation-of-bank-card-luhn-algorithm/
  20. * @author Bernhard Schussek <bschussek@gmail.com>
  21. */
  22. class Luhn extends Constraint
  23. {
  24. const INVALID_CHARACTERS_ERROR = 'dfad6d23-1b74-4374-929b-5cbb56fc0d9e';
  25. const CHECKSUM_FAILED_ERROR = '4d760774-3f50-4cd5-a6d5-b10a3299d8d3';
  26. protected static $errorNames = array(
  27. self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
  28. self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR',
  29. );
  30. public $message = 'Invalid card number.';
  31. }