def convert_to_e164(phone, data)
      match = phone.match full_regex_for_data(data, Core::VALID_PATTERN, !original_starts_with_plus?)
      case
      when match
        "#{data[Core::COUNTRY_CODE]}#{match.to_a.last}"
      when phone.match(cr("^#{data[Core::INTERNATIONAL_PREFIX]}"))
        phone.sub(cr("^#{data[Core::INTERNATIONAL_PREFIX]}"), Core::PLUS_SIGN)
      when original_starts_with_plus? && phone.start_with?(data[Core::COUNTRY_CODE])
        phone
      else
        "#{data[Core::COUNTRY_CODE]}#{phone}"
      end
    end
def convert_to_e164(phone, data)
      match = phone.match full_regex_for_data(data, Core::VALID_PATTERN, !original_starts_with_plus?)
      case
      when match
        "#{data[Core::COUNTRY_CODE]}#{match.to_a.last}"
      when phone.match(cr("^#{data[Core::INTERNATIONAL_PREFIX]}"))
        phone.sub(cr("^#{data[Core::INTERNATIONAL_PREFIX]}"), Core::PLUS_SIGN)
      when original_starts_with_plus? && phone.start_with?(data[Core::COUNTRY_CODE])
        phone
      else
        "#{data[Core::COUNTRY_CODE]}#{phone}"
      end
    end
Create phone representation in e164 format

 ==== Attributes

 * +phone+ - phone number for parsing
 * +data+  - country data to be based on for creating e164 representation