Свойство | Тип | Описание | |
---|---|---|---|
$autodetect | boolean | Whether the country should be auto-detected. | |
$countries | array | Countries to validate against. | |
$countryField | string | null | The field to use for country if not passed as a parameter. | |
$data | array | Dotted validator data. | |
$lenient | boolean | Whether to allow lenient checking of numbers (i.e. landline without area codes). | |
$lib | |||
$types | array | Transformed phone number types to validate against. |
Метод | Описание | |
---|---|---|
__construct ( |
PhoneValidator constructor. | |
isInputField ( string $field ) : boolean | Checks if the given field is an actual input field. | |
isPhoneCountry ( string $country ) : boolean | Checks if the supplied string is a valid country code. | |
isPhoneType ( string $type ) : boolean | Checks if the supplied string is a valid phone number type. | |
validatePhone ( string $attribute, mixed $value, array $parameters, object $validator ) : boolean | Validates a phone number. |
Метод | Описание | |
---|---|---|
assignParameters ( array $parameters ) | Parses the supplied validator parameters. | |
checkCountries ( string $attribute ) | Checks the detected countries. Overrides countries if a country field is present. | |
isValidNumber ( mixed $number, null $country = null ) : boolean | Performs the actual validation of the phone number. | |
parseTypes ( array $types ) : array | Parses the supplied phone number types. |
public __construct ( |
||
$lib |
protected assignParameters ( array $parameters ) | ||
$parameters | array |
protected checkCountries ( string $attribute ) | ||
$attribute | string |
public isInputField ( string $field ) : boolean | ||
$field | string | |
Результат | boolean |
public isPhoneCountry ( string $country ) : boolean | ||
$country | string | |
Результат | boolean |
public isPhoneType ( string $type ) : boolean | ||
$type | string | |
Результат | boolean |
protected parseTypes ( array $types ) : array | ||
$types | array | |
Результат | array |
protected bool $autodetect | ||
Результат | boolean |
protected array $countries | ||
Результат | array |
protected bool $lenient | ||
Результат | boolean |
protected PhoneNumberUtil,libphonenumber $lib | ||
Результат |
protected array $types | ||
Результат | array |