You are here

protected static function CpfCnpjBase::validateValue in Brazilian IDs 8

Validates the submitted value.

Parameters

string $value: The value of the CPF or CNPJ number to be validated.

array $error: If provided, it is filled with the error message at $error['message'] if any.

See also

\Drupal\brazilian_ids\BrazilianIdsService::validateCpfCnpj()

1 call to CpfCnpjBase::validateValue()
CpfCnpjBase::validateElement in src/Element/CpfCnpjBase.php
Validates the CNPJ value.
2 methods override CpfCnpjBase::validateValue()
CnpjElement::validateValue in src/Element/CnpjElement.php
Validates the submitted value.
CpfElement::validateValue in src/Element/CpfElement.php
Validates the submitted value.

File

src/Element/CpfCnpjBase.php, line 107

Class

CpfCnpjBase
Base class for CPF and CNPJ elements.

Namespace

Drupal\brazilian_ids\Element

Code

protected static function validateValue($value, array &$error = []) {
  return \Drupal::service('brazilian_ids')
    ->validateCpfCnpj($value, $error);
}