4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator\Constraints;
14 use Symfony\Component\Validator\Constraint;
17 * Metadata for the LuhnValidator.
20 * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
22 * @author Tim Nagel <t.nagel@infinite.net.au>
23 * @author Greg Knapp http://gregk.me/2011/php-implementation-of-bank-card-luhn-algorithm/
24 * @author Bernhard Schussek <bschussek@gmail.com>
26 class Luhn extends Constraint
28 const INVALID_CHARACTERS_ERROR = 'dfad6d23-1b74-4374-929b-5cbb56fc0d9e';
29 const CHECKSUM_FAILED_ERROR = '4d760774-3f50-4cd5-a6d5-b10a3299d8d3';
31 protected static $errorNames = array(
32 self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
33 self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR',
36 public $message = 'Invalid card number.';