Neuron-PHP

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_PATTERN

public mixed INTERNATIONAL_PATTERN = "/^\\+(?:[0-9] ?){6,14}[0-9]\$/"

US_PATTERN

public mixed US_PATTERN = "/^[0-9]{3}-[0-9]{3}-[0-9]{4}\$/"

Properties

Methods

__construct()

public __construct([int $type = self::US ]) : mixed
Parameters
$type : int = self::US

isValid()

Returns true if validation is successful

public isValid(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

validate()

Abstract method to be implemented by all validators.

public validate(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

        
On this page

Search results