Open hanzi opened 4 years ago
/cc @blacksenator
LGTM on quick glance. Would appreciate confirmation by @blacksenator
I'll do this the next couple of days
Contributer never updated reviewed topics. Beside of this: Apart from that, the implementation of the extensive library does not bring any real improvement over the manual solution in the config. I suggest to close this topic.
Apologies, I must have missed the notification for the review in August.
I've renamed the option from defaultCountry
to country
as requested.
The conversion may be in accordance with the ITU specifications - but can we also be sure that the FRITZ devices will process defined separators in foreign numbers?
I've been using this fork for half a year now, with various international numbers in my address book (from several European countries, India, Taiwan, USA, Vietnam) and never ran into any issues.
Caller ID also works without issues, regardless of formatting in the address book.
As far as I can tell, the Fritzbox happily ignores any whitespace/separators. But as you said, there doesn't seem to be any documentation for that.
Apart from that, the implementation of the extensive library does not bring any real improvement over the manual solution in the config.
I understand the hesitation for including another dependency. That's of course your decision. For me it works quite well and I've also been using it in some customer projects without any issues.
My personal benefits with this solution:
0046
instead of +46
. I know that the latter would be more correct anyway, but that's what I've got.strtr
solution and my address book, but I can't remember them exactly.@andig if @hanzi says that it doesn't cause any problems in the interaction of the devices, then I don't see any reasons why it shouldn't be part of the solution.
This replaces the phone number formatting method using
strtr()
with one that utilises the libphonenumber library (which is PHP port of the Google library with the same name.)That allows a user to just define the country code where the FRITZ!Box will be used and
libphonenumber
will handle the rest.It will automatically apply appropriate formatting for phone numbers and detect whether it's a national or international phone number. See the docblock for the method used: https://github.com/giggsey/libphonenumber-for-php/blob/master/src/PhoneNumberUtil.php#L2643
Fixes #193