-
Notifications
You must be signed in to change notification settings - Fork 106
Change from single provider to chain provider #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for the PR I appreciate it ! I see your point and I can see that can be usefull even it's a BC break :) |
Actually there would be no BC break, since ChainProvider acts as any provider, Geocoder just calls them in the order given and the first result returned is the one that Geocoder uses. As long as FreeGeoIp is listed as the first one, existing functionality would remain the same. I'll reply on #5 about the config thing. |
You're right no BC :) |
I'm quite interested in this. can it be added to dev-master? |
@dwenaus yes :) |
Change from single provider to chain provider
Are you sure you're using dev-master ? I have no BC break. And units tests looks good to me in order to test BC. |
The ChainProvider is by far the most useful. This PR changes the package default to use it, with FreeGeoIpProvider as the default single member of the chain. Client code can then add additional providers just by adding to the providers config array.
Tests are updated accordingly. Because ChainProvider::$providers is protected, I had to add a test method to grab it with ReflectionClass. This feels a little wrong, but I didn't see a better place to put it in your existing test setup. Let me know if this should be revised.