keenlabs / KeenClient-PHP

Official PHP client for the Keen IO API. Build analytics features directly into your PHP apps.
https://keen.io/docs
MIT License
133 stars 57 forks source link

adding support for using default version when empty value provided #70

Closed stevenmaguire closed 9 years ago

stevenmaguire commented 9 years ago

I uncovered a use case that caused the Client to throw errors during configuration load. If the version key is set, and is an empty string, in the factory config param, the Client will fail to load.

I built a test to verify this behavior and it was in fact the case.

The issue, as far as I can tell, is that the Collection::fromConfig method from the Guzzle 3.7 library does not check if the value is empty when merging the arrays, and as such the default version is never applied.

Instead of digging a path of resolution through Guzzle or even upgrading Guzzle within this package (I saw the other issue), I added a method that will perform an adequate check for emptiness of a common default key and assert the rule when encountered.

stevenmaguire commented 9 years ago

bump? @kmfk you seem to have done some work on this one and are in the keenlabs org.

k-k commented 9 years ago

@stevenmaguire - sorry for any delays! Thanks for catching this and providing a fix, looks pretty good to me. Will pull it in and bump a new tag.

stevenmaguire commented 9 years ago

Awesome! Thanks, @kmfk