IsPhoneNumber
extends Base
in package
Requires a valid phone number format nnn-nnn-nnnn
Table of Contents
Constants
- INTERNATIONAL = 20
- INTERNATIONAL_PATTERN = "/^\\+(?:[0-9] ?){6,14}[0-9]\$/"
- US = 10
- US_PATTERN = "/^[0-9]{3}-[0-9]{3}-[0-9]{4}\$/"
Properties
- $_type : mixed
Methods
- __construct() : mixed
- getType() : int
- isValid() : bool
- Returns true if validation is successful
- setType() : IsPhoneNumber
- validate() : bool
- Abstract method to be implemented by all validators.
Constants
INTERNATIONAL
public
mixed
INTERNATIONAL
= 20
INTERNATIONAL_PATTERN
public
mixed
INTERNATIONAL_PATTERN
= "/^\\+(?:[0-9] ?){6,14}[0-9]\$/"
US
public
mixed
US
= 10
US_PATTERN
public
mixed
US_PATTERN
= "/^[0-9]{3}-[0-9]{3}-[0-9]{4}\$/"
Properties
$_type
public
mixed
$_type
Methods
__construct()
public
__construct([int $type = self::US ]) : mixed
Parameters
- $type : int = self::US
getType()
public
getType() : int
Return values
intisValid()
Returns true if validation is successful
public
isValid(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolsetType()
public
setType(int $type) : IsPhoneNumber
Parameters
- $type : int
Return values
IsPhoneNumbervalidate()
Abstract method to be implemented by all validators.
public
validate(mixed $value) : bool
Parameters
- $value : mixed