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();
            }
        }
    }