RSI helpers  0.1
RSI helpers
Valid Class Reference

Validators. More...

Static Public Member Functions

const n const static email ($value)
 Check an e-mail address for syntax and host. More...
 
static postcode ($country, $value)
 Check a postal code for syntax. More...
 
static address ($country, $street, $number, $postcode, $town, $state=null)
 Check all parts of an address for syntax. More...
 
static iban ($value)
 Check if an International Bank Account Number (IBAN) is valid. More...
 
static vatNo ($value, &$info=null)
 Check if an European VAT number is valid. More...
 

Data Fields

const POSTCODE_FORMATS
 
const n const IBAN_FORMATS
 

Detailed Description

Validators.

Definition at line 8 of file Valid.php.

Member Function Documentation

◆ address()

static address (   $country,
  $street,
  $number,
  $postcode,
  $town,
  $state = null 
)
static

Check all parts of an address for syntax.

Parameters
string$countryCountry code (ISO 3166-1 alpha-2).
string$streetStreet name.
string$numberHouse number.
string$postcodePostal code.
string$townTown or city.
string$stateState or province.
Returns
string|bool Formatted address when valid. False when invalid.

Definition at line 149 of file Valid.php.

◆ email()

const n const static email (   $value)
static

Check an e-mail address for syntax and host.

Parameters
string$valueE-mail address.
Returns
bool True if both the e-mail address and the host are valid.

Definition at line 121 of file Valid.php.

◆ iban()

static iban (   $value)
static

Check if an International Bank Account Number (IBAN) is valid.

Parameters
string$valueIBAN (may have extra formatting characters).
Returns
string|bool Formatted IBAN when valid. False when invalid.

Definition at line 166 of file Valid.php.

◆ postcode()

static postcode (   $country,
  $value 
)
static

Check a postal code for syntax.

Parameters
string$countryCountry code (ISO 3166-1 alpha-2).
string$valuePostal code.
Returns
string|bool Formatted postal code when valid. False when invalid.

Definition at line 130 of file Valid.php.

◆ vatNo()

static vatNo (   $value,
$info = null 
)
static

Check if an European VAT number is valid.

Parameters
string$valueVAT number (may have extra formatting characters).
array$infoReturns extra info related to a valid VAT number.
Returns
bool True when valid. If the VAT number could not be checked online this will always be true, $info then holds an error message.

Definition at line 180 of file Valid.php.

Field Documentation

◆ IBAN_FORMATS

const n const IBAN_FORMATS
Initial value:
= [
'AL' => '\\d{8}\\w{16}'

Definition at line 45 of file Valid.php.

◆ POSTCODE_FORMATS

const POSTCODE_FORMATS
Initial value:
= [
'BE' => ['(\\d{4})',[],'$1',"* #\n% @@\nBELGIUM"]

Definition at line 10 of file Valid.php.


The documentation for this class was generated from the following file: