| Total Complexity | 5 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 12 | class CustomerZipCode extends Constraint |
||
| 13 | { |
||
| 14 | public const ZIP_CODE_INVALID = 'ZIP_CODE_INVALID'; |
||
| 15 | |||
| 16 | public ?string $countryId = null; |
||
| 17 | |||
| 18 | public bool $caseSensitiveCheck = true; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var array<string, string> |
||
| 22 | */ |
||
| 23 | protected static $errorNames = [ |
||
| 24 | NotBlank::IS_BLANK_ERROR => 'IS_BLANK_ERROR', |
||
| 25 | self::ZIP_CODE_INVALID => 'ZIP_CODE_INVALID', |
||
| 26 | ]; |
||
| 27 | |||
| 28 | private string $message = 'This value is not a valid ZIP code for country {{ iso }}'; |
||
| 29 | |||
| 30 | private string $messageRequired = 'Postal code is required for that country'; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param mixed $options |
||
| 34 | */ |
||
| 35 | public function __construct($options = null) |
||
| 36 | { |
||
| 37 | if ($options !== null && !\is_array($options)) { |
||
| 38 | $options = [ |
||
| 39 | 'countryId' => $options, |
||
| 40 | ]; |
||
| 41 | } |
||
| 42 | |||
| 43 | parent::__construct($options); |
||
| 44 | } |
||
| 45 | |||
| 46 | public function getMessageRequired(): string |
||
| 47 | { |
||
| 48 | return $this->messageRequired; |
||
| 49 | } |
||
| 50 | |||
| 51 | public function getMessage(): string |
||
| 54 | } |
||
| 55 | } |
||
| 56 |