diff --git a/src/PhoneNumberUtil.php b/src/PhoneNumberUtil.php index 38b3e8db4..922bddb00 100644 --- a/src/PhoneNumberUtil.php +++ b/src/PhoneNumberUtil.php @@ -91,7 +91,7 @@ class PhoneNumberUtil // The FIRST_GROUP_PATTERN was originally set to $1 but there are some countries for which the // first group is not used in the national pattern (e.g. Argentina) so the $1 group does not match - // correctly. Therefore, we use \d, so that the first group actually used in the pattern will be + // correctly. Therefore, we use \d, so that the first group actually used in the pattern will be // matched. const FIRST_GROUP_PATTERN = "(\\$\\d)"; // Constants used in the formatting rules to represent the national prefix, first group and @@ -101,7 +101,7 @@ class PhoneNumberUtil const CC_STRING = '$CC'; // A pattern that is used to determine if the national prefix formatting rule has the first group - // only, i.e., does not start with the national prefix. Note that the pattern explicitly allows + // only, i.e, does not start with the national prefix. Note that the pattern explicitly allows // for unbalanced parentheses. const FIRST_GROUP_ONLY_PREFIX_PATTERN = '\\(?\\$1\\)?'; public static $PLUS_CHARS_PATTERN; @@ -120,6 +120,7 @@ class PhoneNumberUtil /** * Only upper-case variants of alpha characters are stored. + * * @var array */ protected static $ALPHA_MAPPINGS = array( @@ -155,6 +156,7 @@ class PhoneNumberUtil * Map of country calling codes that use a mobile token before the area code. One example of when * this is relevant is when determining the length of the national destination code, which should * be the length of the area code plus the length of the mobile token. + * * @var array */ protected static $MOBILE_TOKEN_MAPPINGS = array(); @@ -182,6 +184,7 @@ class PhoneNumberUtil /** * For performance reasons, amalgamate both into one map. + * * @var array */ protected static $ALPHA_PHONE_MAPPINGS; @@ -189,6 +192,7 @@ class PhoneNumberUtil /** * Separate map of all symbols that we wish to retain when formatting alpha numbers. This * includes digits, ASCII letters and number grouping symbols such as "-" and " ". + * * @var array */ protected static $ALL_PLUS_NUMBER_GROUPING_SYMBOLS; @@ -196,6 +200,7 @@ class PhoneNumberUtil /** * Simple ASCII digits map used to populate ALPHA_PHONE_MAPPINGS and * ALL_PLUS_NUMBER_GROUPING_SYMBOLS. + * * @var array */ protected static $asciiDigitMappings = array( @@ -215,11 +220,13 @@ class PhoneNumberUtil * Regexp of all possible ways to write extensions, for use when parsing. This will be run as a * case-insensitive regexp match. Wide character versions are also provided after each ASCII * version. + * * @var String */ protected static $EXTN_PATTERNS_FOR_PARSING; /** * @var string + * * @internal */ public static $EXTN_PATTERNS_FOR_MATCHING; @@ -243,6 +250,7 @@ class PhoneNumberUtil * have alpha-characters and punctuation. * * Note VALID_PUNCTUATION starts with a -, so must be the first in the range. + * * @var string */ protected static $VALID_PHONE_NUMBER; @@ -294,11 +302,13 @@ class PhoneNumberUtil /** * The set of county calling codes that map to the non-geo entity region ("001"). + * * @var array */ protected $countryCodesForNonGeographicalRegion = array(); /** * The set of regions the library supports. + * * @var array */ protected $supportedRegions = array(); @@ -308,11 +318,13 @@ class PhoneNumberUtil * by that country calling code. In the case of multiple regions sharing a calling code, such as * the NANPA regions, the one indicated with "isMainCountryForCode" in the metadata should be * first. + * * @var array */ protected $countryCallingCodeToRegionCodeMap = array(); /** * The set of regions that share country calling code 1. + * * @var array */ protected $nanpaRegions = array(); @@ -393,10 +405,10 @@ protected function __construct(MetadataSourceInterface $metadataSource, $country /** * Gets a {@link PhoneNumberUtil} instance to carry out international phone number formatting, - * parsing, or validation. The instance is loaded with phone number metadata for a number of most + * parsing or validation. The instance is loaded with phone number metadata for a number of most * commonly used regions. * - *
The {@link PhoneNumberUtil} is implemented as a singleton. Therefore, calling getInstance + *
The {@link PhoneNumberUtil} is implemented as a singleton. Therefore calling getInstance * multiple times will only result in one instance being created. * * @param string $baseFileLocation @@ -481,6 +493,7 @@ public static function initExtnPatterns() /** * Helper initialiser method to create the regular-expression pattern to match extensions, * allowing the one-char extension symbols provided by {@code singleExtnSymbols}. + * * @param string $singleExtnSymbols * @return string */ @@ -552,6 +565,7 @@ public static function resetInstance() /** * Converts all alpha characters in a number to their respective digits on a keypad, but retains * existing formatting. + * * @param string $number * @return string */ @@ -571,10 +585,10 @@ public static function convertAlphaCharactersInNumber($number) * * @param string $number a string of characters representing a phone number * @param array $normalizationReplacements a mapping of characters to what they should be replaced by in - * the normalized version of the phone number - * @param bool $removeNonMatches indicates whether characters that are not able to be replaced + * the normalized version of the phone number. + * @param bool $removeNonMatches indicates whether characters that are not able to be replaced. * should be stripped from the number. If this is false, they will be left unchanged in the number. - * @return string the normalized string version of the phone number + * @return string the normalized string version of the phone number. */ protected static function normalizeHelper($number, array $normalizationReplacements, $removeNonMatches) { @@ -595,6 +609,7 @@ protected static function normalizeHelper($number, array $normalizationReplaceme /** * Helper function to check if the national prefix formatting rule has the first group only, i.e., * does not start with the national prefix. + * * @param string $nationalPrefixFormattingRule * @return bool */ @@ -677,7 +692,7 @@ protected static function descHasData(PhoneNumberDesc $desc) } /** - * Returns the types we have metadata for based on the PhoneMetadata object passed in + * Returns the types we have metadata for based on the PhoneMetadata object passed in. * * @param PhoneMetadata $metadata * @return array @@ -773,6 +788,7 @@ public function getSupportedTypesForNonGeoEntity($countryCallingCode) * entities *