getExpectedCost() public method

For example, if a number is STANDARD_RATE in the US, but TOLL_FREE in Canada, the expected cost returned by this method will be STANDARD_RATE, since the NANPA countries share the same country calling code.

Note: If the region from which the number is dialed is known, it is highly preferable to call {@link #getExpectedCostForRegion(PhoneNumber, String)} instead.
public getExpectedCost ( PhoneNumber $number ) : integer
$number PhoneNumber the short number for which we want to know the expected cost category
return integer the highest expected cost category of the short number in the region(s) with the given country calling code
コード例 #1
0
 public function testEmergencyNumberForSharedCountryCallingCode()
 {
     // Test the emergency number 112, which is valid in both Australia and the Christmas Islands.
     $this->assertTrue($this->shortInfo->isEmergencyNumber("112", RegionCode::AU));
     $this->assertTrue($this->shortInfo->isValidShortNumberForRegion($this->parse("112", RegionCode::AU), RegionCode::AU));
     $this->assertEquals(ShortNumberCost::TOLL_FREE, $this->shortInfo->getExpectedCostForRegion($this->parse("112", RegionCode::AU), RegionCode::AU));
     $this->assertTrue($this->shortInfo->isEmergencyNumber("112", RegionCode::CX));
     $this->assertTrue($this->shortInfo->isValidShortNumberForRegion($this->parse("112", RegionCode::CX), RegionCode::CX));
     $this->assertEquals(ShortNumberCost::TOLL_FREE, $this->shortInfo->getExpectedCostForRegion($this->parse("112", RegionCode::CX), RegionCode::CX));
     $sharedEmergencyNumber = new PhoneNumber();
     $sharedEmergencyNumber->setCountryCode(61)->setNationalNumber(112);
     $this->assertTrue($this->shortInfo->isValidShortNumber($sharedEmergencyNumber));
     $this->assertEquals(ShortNumberCost::TOLL_FREE, $this->shortInfo->getExpectedCost($sharedEmergencyNumber));
 }