public function CreditCardType::__construct in Commerce Core 8.2
Constructs a new CreditCardType instance.
Parameters
array $definition: The definition.
File
- modules/
payment/ src/ CreditCardType.php, line 58
Class
- CreditCardType
- Represents a credit card type.
Namespace
Drupal\commerce_paymentCode
public function __construct(array $definition) {
foreach ([
'id',
'label',
'number_prefixes',
] as $required_property) {
if (empty($definition[$required_property])) {
throw new \InvalidArgumentException(sprintf('Missing required property %s.', $required_property));
}
}
$this->id = $definition['id'];
$this->label = $definition['label'];
$this->numberPrefixes = $definition['number_prefixes'];
if (isset($definition['number_lengths'])) {
$this->numberLengths = $definition['number_lengths'];
}
if (isset($definition['security_code_length'])) {
$this->securityCodeLength = $definition['security_code_length'];
}
if (isset($definition['uses_luhn'])) {
$this->usesLuhn = $definition['uses_luhn'];
}
}