Check whether a short number is a possible number. If a country calling code is shared by
multiple regions, this returns true if it's possible in any of them. This provides a more
lenient check than {@link #isValidShortNumber}. See {@link
#IsPossibleShortNumberForRegion(PhoneNumber, String)} for details.
public isPossibleShortNumber ( |
||
$number | PhoneNumber the short number to check | |
return | boolean | whether the number is a possible short number |
public function testIsPossibleShortNumber() { $possibleNumber = new PhoneNumber(); $possibleNumber->setCountryCode(33)->setNationalNumber(123456); $this->assertTrue($this->shortInfo->isPossibleShortNumber($possibleNumber)); $this->assertTrue($this->shortInfo->isPossibleShortNumberForRegion($this->parse(123456, RegionCode::FR), RegionCode::FR)); $impossibleNumber = new PhoneNumber(); $impossibleNumber->setCountryCode(33)->setNationalNumber(9); $this->assertFalse($this->shortInfo->isPossibleShortNumber($impossibleNumber)); // Note that GB and GG share the country calling code 44, and that this number is possible but // not valid. $gbNumber = new PhoneNumber(); $gbNumber->setCountryCode(44)->setNationalNumber(11001); $this->assertTrue($this->shortInfo->isPossibleShortNumber($gbNumber)); }