\VATCheckerVATNumber

Class used to check the validity of a VAT-Number

Summary

Methods
Properties
Constants
__construct()
validate()
validateFormat()
checkValidity()
isValid()
No public properties found
RESPONSE_TIMEOUT
INVALID_COUNTRY_CODE
INVALID_FORMAT
UNABLE_TO_CHECK
VALID_VAT_NUMBER
INVALID_VAT_NUMBER
EMPTY_VAT_NUMBER
VALID_VAT_FORMAT
No protected methods found
No protected properties found
N/A
No private methods found
$countryCode
$vatNumber
$input
$soapClient
$countries
N/A

Constants

RESPONSE_TIMEOUT

RESPONSE_TIMEOUT

INVALID_COUNTRY_CODE

INVALID_COUNTRY_CODE

INVALID_FORMAT

INVALID_FORMAT

UNABLE_TO_CHECK

UNABLE_TO_CHECK

VALID_VAT_NUMBER

VALID_VAT_NUMBER

INVALID_VAT_NUMBER

INVALID_VAT_NUMBER

EMPTY_VAT_NUMBER

EMPTY_VAT_NUMBER

VALID_VAT_FORMAT

VALID_VAT_FORMAT

Properties

$countryCode

$countryCode : string

Type

string — Contains the first two characters of the input of the constructor

$vatNumber

$vatNumber : string

Type

string — Contains the part of the VAT-number after the country code

$input

$input : string

Type

string — Will contain the input of the constructor

$soapClient

$soapClient : \SoapClient

Type

\SoapClient — Holds the \SoapClient object

$countries

$countries : array

Type

array — Contains all the regular expressions for all the possible VAT-numbers

Methods

__construct()

__construct(string  $vatNumber) 

Constructor

Stores the country-code and the actual VAT-number in the class variables.

Parameters

string $vatNumber

The VAT-Number to be checked

validate()

validate() : integer

Checks the validity of the VAT-number.

If the VAT-Number is not valid, it will return an integer which describe the reason why the VAT-number is invalid.

Returns

integer

validateFormat()

validateFormat() : integer

Validate the format of the given VAT number

Returns

integer

checkValidity()

checkValidity() : integer

Performs a call against the webservice of the EC

Returns

integer

isValid()

isValid() : boolean

Checks if the VAT-number is valid.

If it's not valid, it will not tell why it isn't valid.

Returns

boolean