Iban.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. * @Annotation
  14. * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
  15. *
  16. * @author Manuel Reinhard <manu@sprain.ch>
  17. * @author Michael Schummel
  18. * @author Bernhard Schussek <bschussek@gmail.com>
  19. */
  20. #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
  21. class Iban extends Constraint
  22. {
  23. public const INVALID_COUNTRY_CODE_ERROR = 'de78ee2c-bd50-44e2-aec8-3d8228aeadb9';
  24. public const INVALID_CHARACTERS_ERROR = '8d3d85e4-784f-4719-a5bc-d9e40d45a3a5';
  25. public const CHECKSUM_FAILED_ERROR = 'b9401321-f9bf-4dcb-83c1-f31094440795';
  26. public const INVALID_FORMAT_ERROR = 'c8d318f1-2ecc-41ba-b983-df70d225cf5a';
  27. public const NOT_SUPPORTED_COUNTRY_CODE_ERROR = 'e2c259f3-4b46-48e6-b72e-891658158ec8';
  28. protected static $errorNames = [
  29. self::INVALID_COUNTRY_CODE_ERROR => 'INVALID_COUNTRY_CODE_ERROR',
  30. self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
  31. self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR',
  32. self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR',
  33. self::NOT_SUPPORTED_COUNTRY_CODE_ERROR => 'NOT_SUPPORTED_COUNTRY_CODE_ERROR',
  34. ];
  35. public $message = 'This is not a valid International Bank Account Number (IBAN).';
  36. public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null)
  37. {
  38. parent::__construct($options, $groups, $payload);
  39. $this->message = $message ?? $this->message;
  40. }
  41. }