function Bic::__construct
Parameters
array<string,mixed>|null $options:
string|null $iban An IBAN value to validate that its country code is the same as the BIC's one:
string|null $ibanPropertyPath Property path to the IBAN value when validating objects:
string[]|null $groups:
self::VALIDATION_MODE_*|null $mode The mode used to validate the BIC; pass null to use the default mode (strict):
Overrides Constraint::__construct
File
-
vendor/
symfony/ validator/ Constraints/ Bic.php, line 73
Class
- Bic
- Ensures that the value is valid against the BIC format.
Namespace
Symfony\Component\Validator\ConstraintsCode
public function __construct(?array $options = null, ?string $message = null, ?string $iban = null, ?string $ibanPropertyPath = null, ?string $ibanMessage = null, ?array $groups = null, mixed $payload = null, ?string $mode = null) {
if (!class_exists(Countries::class)) {
throw new LogicException('The Intl component is required to use the Bic constraint. Try running "composer require symfony/intl".');
}
if (\is_array($options) && \array_key_exists('mode', $options) && !\in_array($options['mode'], self::VALIDATION_MODES, true)) {
throw new InvalidArgumentException('The "mode" parameter value is not valid.');
}
if (null !== $mode && !\in_array($mode, self::VALIDATION_MODES, true)) {
throw new InvalidArgumentException('The "mode" parameter value is not valid.');
}
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
$this->ibanMessage = $ibanMessage ?? $this->ibanMessage;
$this->iban = $iban ?? $this->iban;
$this->ibanPropertyPath = $ibanPropertyPath ?? $this->ibanPropertyPath;
$this->mode = $mode ?? $this->mode;
if (null !== $this->iban && null !== $this->ibanPropertyPath) {
throw new ConstraintDefinitionException('The "iban" and "ibanPropertyPath" options of the Iban constraint cannot be used at the same time.');
}
if (null !== $this->ibanPropertyPath && !class_exists(PropertyAccess::class)) {
throw new LogicException(\sprintf('The "symfony/property-access" component is required to use the "%s" constraint with the "ibanPropertyPath" option. Try running "composer require symfony/property-access".', self::class));
}
}