def analyze(phone, passed_country)
      country = country_or_default_country passed_country

      result = parse_country(phone, country)
      d_result = case
                 when result && result.values.find { |e| e[:valid].any? }
                   # all is good, return result
                 when passed_country.nil?
                   # trying for all countries if no country was passed
                   detect_and_parse(phone, country)
                 when country_can_dp?(country)
                   # if country allows double prefix trying modified phone
                   parse_country(changed_dp_phone(country, phone), country)
                 end
      better_result(result, d_result)
    end
def analyze(phone, passed_country)
      country = country_or_default_country passed_country

      result = parse_country(phone, country)
      d_result = case
                 when result && result.values.find { |e| e[:valid].any? }
                   # all is good, return result
                 when passed_country.nil?
                   # trying for all countries if no country was passed
                   detect_and_parse(phone, country)
                 when country_can_dp?(country)
                   # if country allows double prefix trying modified phone
                   parse_country(changed_dp_phone(country, phone), country)
                 end
      better_result(result, d_result)
    end
parses provided phone if it is valid for  country data and
 returns result of analyze

 ==== Attributes

 * +phone+ - Phone number for parsing
 * +passed_country+ - Country provided for parsing. Must be ISO code of
   country (2 letters) like 'US', 'us' or :us for United States