function Isbn::__construct
Parameters
self::ISBN_*|array<string,mixed>|null $type The type of ISBN to validate (i.e. {@see Isbn::ISBN_10}, {@see Isbn::ISBN_13} or null to accept both, defaults to null):
string|null $message If defined, this message has priority over the others:
string[]|null $groups:
array<string,mixed> $options:
Overrides Constraint::__construct
File
-
vendor/
symfony/ validator/ Constraints/ Isbn.php, line 57
Class
- Isbn
- Validates that a value is a valid ISBN according to ISBN-10 or ISBN-13 formats.
Namespace
Symfony\Component\Validator\ConstraintsCode
public function __construct(string|array|null $type = null, ?string $message = null, ?string $isbn10Message = null, ?string $isbn13Message = null, ?string $bothIsbnMessage = null, ?array $groups = null, mixed $payload = null, array $options = []) {
if (\is_array($type)) {
$options = array_merge($type, $options);
}
elseif (null !== $type) {
$options['value'] = $type;
}
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
$this->isbn10Message = $isbn10Message ?? $this->isbn10Message;
$this->isbn13Message = $isbn13Message ?? $this->isbn13Message;
$this->bothIsbnMessage = $bothIsbnMessage ?? $this->bothIsbnMessage;
}