You are here

public function TaxNumberTypeBase::canonicalize in Commerce Core 8.2

Canonicalizes the given tax number.

Parameters

string $tax_number: The tax number.

Return value

string The canonicalized tax number.

Overrides TaxNumberTypeInterface::canonicalize

File

modules/tax/src/Plugin/Commerce/TaxNumberType/TaxNumberTypeBase.php, line 52

Class

TaxNumberTypeBase
Provides the base class for tax number types.

Namespace

Drupal\commerce_tax\Plugin\Commerce\TaxNumberType

Code

public function canonicalize($tax_number) {

  // Remove spaces, dots, dashes from the entered number.
  return preg_replace('/[ .-]/', '', $tax_number);
}