libphonenumber\PhoneNumberUtil::isNANPACountry PHP 메소드

isNANPACountry() 공개 메소드

Checks if this is a region under the North American Numbering Plan Administration (NANPA).
public isNANPACountry ( string $regionCode ) : boolean
$regionCode string
리턴 boolean true if regionCode is one of the regions under NANPA
    public function isNANPACountry($regionCode)
    {
        return in_array($regionCode, $this->nanpaRegions);
    }

Usage Example

 public function testIsNANPACountry()
 {
     $this->assertTrue($this->phoneUtil->isNANPACountry(RegionCode::US));
     $this->assertTrue($this->phoneUtil->isNANPACountry(RegionCode::BS));
     $this->assertFalse($this->phoneUtil->isNANPACountry(RegionCode::DE));
     $this->assertFalse($this->phoneUtil->isNANPACountry(RegionCode::ZZ));
     $this->assertFalse($this->phoneUtil->isNANPACountry(RegionCode::UN001));
     $this->assertFalse($this->phoneUtil->isNANPACountry(null));
 }
PhoneNumberUtil