src/PhoneNumberUtil.php
protected function maybeAppendFormattedExtension(PhoneNumber $number, $metadata, $numberFormat, &$formattedNumber)
    {
        if ($number->hasExtension() && mb_strlen($number->getExtension()) > 0) {
            if ($numberFormat === PhoneNumberFormat::RFC3966) {
                $formattedNumber .= static::RFC3966_EXTN_PREFIX . $number->getExtension();
            } elseif (!empty($metadata) && $metadata->hasPreferredExtnPrefix()) {
                $formattedNumber .= $metadata->getPreferredExtnPrefix() . $number->getExtension();
            } else {
                $formattedNumber .= static::DEFAULT_EXTN_PREFIX . $number->getExtension();
            }
        }
    }
protected function maybeAppendFormattedExtension(PhoneNumber $number, $metadata, $numberFormat, &$formattedNumber)
    {
        if ($number->hasExtension() && mb_strlen($number->getExtension()) > 0) {
            if ($numberFormat === PhoneNumberFormat::RFC3966) {
                $formattedNumber .= static::RFC3966_EXTN_PREFIX . $number->getExtension();
            } elseif (!empty($metadata) && $metadata->hasPreferredExtnPrefix()) {
                $formattedNumber .= $metadata->getPreferredExtnPrefix() . $number->getExtension();
            } else {
                $formattedNumber .= static::DEFAULT_EXTN_PREFIX . $number->getExtension();
            }
        }
    }
protected function maybeAppendFormattedExtension ( PhoneNumber $ number , $ metadata , $ numberFormat , & $ formattedNumber ) { if ( $ number -> hasExtension ( ) && mb_strlen ( $ number -> getExtension ( ) ) > 0 ) { if ( $ numberFormat === PhoneNumberFormat :: RFC3966 ) { $ formattedNumber .= static :: RFC3966_EXTN_PREFIX . $ number -> getExtension ( ) ; } elseif ( ! empty ( $ metadata ) && $ metadata -> hasPreferredExtnPrefix ( ) ) { $ formattedNumber .= $ metadata -> getPreferredExtnPrefix ( ) . $ number -> getExtension ( ) ; } else { $ formattedNumber .= static :: DEFAULT_EXTN_PREFIX . $ number -> getExtension ( ) ; } } }
Appends the formatted extension of a phone number to formattedNumber, if the phone number had
an extension specified.

@param PhoneNumber $number
@param PhoneMetadata|null $metadata
@param int $numberFormat PhoneNumberFormat
@param string $formattedNumber
Appends the formatted extension of a phone number to formattedNumber if the phone number had an extension specified .