/**
  * @param string $nationalNumber
  * @param PhoneMetadata $metadata
  * @return int PhoneNumberType constant
  */
 private function getNumberTypeHelper($nationalNumber, PhoneMetadata $metadata)
 {
     if (!$this->isNumberMatchingDesc($nationalNumber, $metadata->getGeneralDesc())) {
         return PhoneNumberType::UNKNOWN;
     }
     if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getPremiumRate())) {
         return PhoneNumberType::PREMIUM_RATE;
     }
     if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getTollFree())) {
         return PhoneNumberType::TOLL_FREE;
     }
     if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getSharedCost())) {
         return PhoneNumberType::SHARED_COST;
     }
     if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getVoip())) {
         return PhoneNumberType::VOIP;
     }
     if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getPersonalNumber())) {
         return PhoneNumberType::PERSONAL_NUMBER;
     }
     if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getPager())) {
         return PhoneNumberType::PAGER;
     }
     if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getUan())) {
         return PhoneNumberType::UAN;
     }
     if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getVoicemail())) {
         return PhoneNumberType::VOICEMAIL;
     }
     $isFixedLine = $this->isNumberMatchingDesc($nationalNumber, $metadata->getFixedLine());
     if ($isFixedLine) {
         if ($metadata->isSameMobileAndFixedLinePattern()) {
             return PhoneNumberType::FIXED_LINE_OR_MOBILE;
         } else {
             if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getMobile())) {
                 return PhoneNumberType::FIXED_LINE_OR_MOBILE;
             }
         }
         return PhoneNumberType::FIXED_LINE;
     }
     // Otherwise, test to see if the number is mobile. Only do this if certain that the patterns for
     // mobile and fixed line aren't the same.
     if (!$metadata->isSameMobileAndFixedLinePattern() && $this->isNumberMatchingDesc($nationalNumber, $metadata->getMobile())) {
         return PhoneNumberType::MOBILE;
     }
     return PhoneNumberType::UNKNOWN;
 }