location icon indicating copy to clipboard operation
location copied to clipboard

Mixed usage of area code values

Open dmyers opened this issue 1 month ago • 1 comments

It seems the area code is implemented differently in several drivers. Some drivers are returning the region/state such as CA and some are returning real area codes like phone numbers such as 555.

I think this makes it difficult to implement and rely on this attribute with the fallback functionality. Imagine inserting data with the area code and having different values in a database, it would result in a lot of bugs and cases needing to account for these differences. Is there a way maybe some of these non numeric drivers could just set their values to null?

Are there any other things like this that might be good to outline in the readme?

dmyers avatar May 03 '24 17:05 dmyers

Hi @dmyers,

Are you able to identify which drivers are returning different data for area code? The driver name should be included in the Position object returned via the Location::get() method.

stevebauman avatar May 04 '24 01:05 stevebauman

https://github.com/stevebauman/location/blob/master/src/Drivers/IpApi.php#L31

dmyers avatar May 20 '24 22:05 dmyers