本文整理匯總了PHP中PhoneNumber::isItalianLeadingZero方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhoneNumber::isItalianLeadingZero方法的具體用法?PHP PhoneNumber::isItalianLeadingZero怎麽用?PHP PhoneNumber::isItalianLeadingZero使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PhoneNumber
的用法示例。
在下文中一共展示了PhoneNumber::isItalianLeadingZero方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: hasUnexpectedItalianLeadingZero
/**
* Returns true if a number is from a region whose national significant number couldn't contain a
* leading zero, but has the italian_leading_zero field set to true.
* @param PhoneNumber $number
* @return bool
*/
private function hasUnexpectedItalianLeadingZero(PhoneNumber $number)
{
return $number->isItalianLeadingZero() && !$this->isLeadingZeroPossible($number->getCountryCode());
}
示例2: getNationalSignificantNumber
/**
* Gets the national significant number of the a phone number. Note a national significant number
* doesn't contain a national prefix or any formatting.
*
* @param \libphonenumber\PhoneNumber $number the phone number for which the national significant number is needed
* @return string the national significant number of the PhoneNumber object passed in
*/
public function getNationalSignificantNumber(PhoneNumber $number)
{
// If a leading zero has been set, we prefix this now. Note this is not a national prefix.
$nationalNumber = $number->isItalianLeadingZero() ? "0" : "";
$nationalNumber .= $number->getNationalNumber();
return $nationalNumber;
}
示例3: mergeFrom
/**
* Merges the information from another phone number into this phone number.
*
* @param PhoneNumber $other The phone number to copy.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function mergeFrom(PhoneNumber $other)
{
if ($other->hasCountryCode()) {
$this->setCountryCode($other->getCountryCode());
}
if ($other->hasNationalNumber()) {
$this->setNationalNumber($other->getNationalNumber());
}
if ($other->hasExtension()) {
$this->setExtension($other->getExtension());
}
if ($other->hasItalianLeadingZero()) {
$this->setItalianLeadingZero($other->isItalianLeadingZero());
}
if ($other->hasNumberOfLeadingZeros()) {
$this->setNumberOfLeadingZeros($other->getNumberOfLeadingZeros());
}
if ($other->hasRawInput()) {
$this->setRawInput($other->getRawInput());
}
if ($other->hasCountryCodeSource()) {
$this->setCountryCodeSource($other->getCountryCodeSource());
}
if ($other->hasPreferredDomesticCarrierCode()) {
$this->setPreferredDomesticCarrierCode($other->getPreferredDomesticCarrierCode());
}
return $this;
}
示例4: getNationalSignificantNumber
/**
* Gets the national significant number of the a phone number. Note a national significant number
* doesn't contain a national prefix or any formatting.
* <p>
* This is a temporary duplicate of the {@code getNationalSignificantNumber} method from
* {@code PhoneNumberUtil}. Ultimately a canonical static version should exist in a separate
* utility class (to prevent {@code ShortNumberInfo} needing to depend on PhoneNumberUtil).
*
* @param PhoneNumber $number the phone number for which the national significant number is needed
* @return string the national significant number of the PhoneNumber object passed in
*/
private function getNationalSignificantNumber(PhoneNumber $number)
{
// If leading zero(s) have been set, we prefix this now. Note this is not a national prefix.
$nationalNumber = '';
if ($number->isItalianLeadingZero()) {
$zeros = str_repeat('0', $number->getNumberOfLeadingZeros());
$nationalNumber .= $zeros;
}
$nationalNumber .= $number->getNationalNumber();
return $nationalNumber;
}