Вход Регистрация
Файл: gapps/vendor/fzaninotto/faker/src/Faker/Provider/en_US/PhoneNumber.php
Строк: 105
<?php

namespace FakerProvideren_US;

class 
PhoneNumber extends FakerProviderPhoneNumber
{
    
/**
     * @see https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#United_States.2C_Canada.2C_and_other_NANP_countries
     */
    
protected static $formats = array(
        
// International format
        
'+1-{{areaCode}}-{{exchangeCode}}-####',
        
'+1 ({{areaCode}}) {{exchangeCode}}-####',
        
'+1-{{areaCode}}-{{exchangeCode}}-####',
        
'+1.{{areaCode}}.{{exchangeCode}}.####',
        
'+1{{areaCode}}{{exchangeCode}}####',

        
// Standard formats
        
'{{areaCode}}-{{exchangeCode}}-####',
        
'({{areaCode}}) {{exchangeCode}}-####',
        
'1-{{areaCode}}-{{exchangeCode}}-####',
        
'{{areaCode}}.{{exchangeCode}}.####',

        
'{{areaCode}}-{{exchangeCode}}-####',
        
'({{areaCode}}) {{exchangeCode}}-####',
        
'1-{{areaCode}}-{{exchangeCode}}-####',
        
'{{areaCode}}.{{exchangeCode}}.####',

        
// Extensions
        
'{{areaCode}}-{{exchangeCode}}-#### x###',
        
'({{areaCode}}) {{exchangeCode}}-#### x###',
        
'1-{{areaCode}}-{{exchangeCode}}-#### x###',
        
'{{areaCode}}.{{exchangeCode}}.#### x###',

        
'{{areaCode}}-{{exchangeCode}}-#### x####',
        
'({{areaCode}}) {{exchangeCode}}-#### x####',
        
'1-{{areaCode}}-{{exchangeCode}}-#### x####',
        
'{{areaCode}}.{{exchangeCode}}.#### x####',

        
'{{areaCode}}-{{exchangeCode}}-#### x#####',
        
'({{areaCode}}) {{exchangeCode}}-#### x#####',
        
'1-{{areaCode}}-{{exchangeCode}}-#### x#####',
        
'{{areaCode}}.{{exchangeCode}}.#### x#####'
    
);

    
/**
     * @see https://en.wikipedia.org/wiki/Toll-free_telephone_number#United_States
     */
    
protected static $tollFreeAreaCodes = array(
        
800844855866877888
    
);
    protected static 
$tollFreeFormats = array(
        
// Standard formats
        
'{{tollFreeAreaCode}}-{{exchangeCode}}-####',
        
'({{tollFreeAreaCode}}) {{exchangeCode}}-####',
        
'1-{{tollFreeAreaCode}}-{{exchangeCode}}-####',
        
'{{tollFreeAreaCode}}.{{exchangeCode}}.####',
    );

    public function 
tollFreeAreaCode()
    {
        return 
self::randomElement(static::$tollFreeAreaCodes);
    }

    public function 
tollFreePhoneNumber()
    {
        
$format self::randomElement(static::$tollFreeFormats);

        return 
self::numerify($this->generator->parse($format));
    }

    
/**
     * NPA-format area code
     *
     * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system
     *
     * @return string
     */
    
public static function areaCode()
    {
        
$digits[] = self::numberBetween(29);
        
$digits[] = self::randomDigit();
        
$digits[] = self::randomDigitNot($digits[1]);

        return 
join(''$digits);
    }

    
/**
     * NXX-format central office exchange code
     *
     * @see https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Numbering_system
     *
     * @return string
     */
    
public static function exchangeCode()
    {
        
$digits[] = self::numberBetween(29);
        
$digits[] = self::randomDigit();

        if (
$digits[1] === 1) {
            
$digits[] = self::randomDigitNot(1);
        } else {
            
$digits[] = self::randomDigit();
        }

        return 
join(''$digits);
    }
}
Онлайн: 2
Реклама