class VatNumber

Properties summary

Type Property Description
protected string $identifier
protected string $prefix
protected string $number

Methods summary

Return Type Method Name Description
static VatNumber factoryFromIdentifier(string $identifier) -
static VatNumber factoryFromInput(string $input) Create new instance, normalizing input prior to instantiation
static string normalizeIdentifierInput(string $input) -
array parseIdentifier(string $identifier) -
string getIdentifier() Full string representation of a VAT number
string getPrefix() (country) prefix related to the VAT number.
string getNumber() The number portion of the VAT number (ie, sans any prefix). Note while by convention this is named a number, there may be alpha characters present.
bool isUK() Should the VAT number be treated as belonging to a UK business entity
bool isEU() Should the VAT number be treated as belonging to a country in the EEA
bool isValid() -

Details

static VatNumber factoryFromIdentifier (string $identifier)

Parameters

string $identifier

Return Value

VatNumber

static VatNumber factoryFromInput (string $input)

Create new instance, normalizing input prior to instantiation

Parameters

string $input

Return Value

VatNumber

static protected string normalizeIdentifierInput (string $input)

Parameters

string $input

Return Value

string

protected array parseIdentifier (string $identifier)

Parameters

string $identifier

Return Value

array [, ]

string getIdentifier ()

Full string representation of a VAT number

Return Value

string

string getPrefix ()

(country) prefix related to the VAT number.

WHMCS has a legacy that UK VAT number may or may not have the GB prefix.

Return Value

string

string getNumber ()

The number portion of the VAT number (ie, sans any prefix). Note while by convention this is named a number, there may be alpha characters present.

Return Value

string

bool isUK ()

Should the VAT number be treated as belonging to a UK business entity

Return Value

bool

bool isEU ()

Should the VAT number be treated as belonging to a country in the EEA

Return Value

bool

bool isValid ()

Return Value

bool