It's great how you're passing the entire API response directly to $this->hydrate(). This particular API returns a currency key as an array with a sub key labelled code which contains the ISO code that we actually need.
The GeoIP class only checks whether the currency key is empty before passing the entire contents of that key to GeoIP::getCurrency(), causing the following error to be thrown after the currency is incorrectly cached as an array instead of a string:
strtoupper() expects parameter 1 to be string, array given
You've committed sloppy work. Compare this to the IPApi class in which the author is carefully transforming the array keys returned by the API with the array keys in which GeoIP expects.
I'm quite pissed off right now because you've wasted 1 hour of my time and now I need to submit a PR to fix your code.
@janicerar
It's great how you're passing the entire API response directly to
$this->hydrate()
. This particular API returns acurrency
key as an array with a sub key labelledcode
which contains the ISO code that we actually need.The
GeoIP
class only checks whether thecurrency
key is empty before passing the entire contents of that key toGeoIP::getCurrency()
, causing the following error to be thrown after the currency is incorrectly cached as an array instead of a string:strtoupper() expects parameter 1 to be string, array given
You've committed sloppy work. Compare this to the
IPApi
class in which the author is carefully transforming the array keys returned by the API with the array keys in whichGeoIP
expects.I'm quite pissed off right now because you've wasted 1 hour of my time and now I need to submit a PR to fix your code.