Skip to content

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

Merged
merged 2 commits into from
May 12, 2014

Conversation

anaxamaxan
Copy link
Contributor

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.

@toin0u
Copy link
Member

toin0u commented Feb 1, 2014

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 :)
But I think we need to find the best solution for this issue #5 before..

@anaxamaxan
Copy link
Contributor Author

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.

@toin0u
Copy link
Member

toin0u commented Feb 1, 2014

You're right no BC :)

@dwenaus
Copy link
Contributor

dwenaus commented May 12, 2014

I'm quite interested in this. can it be added to dev-master?

@toin0u
Copy link
Member

toin0u commented May 12, 2014

@dwenaus yes :)

toin0u added a commit that referenced this pull request May 12, 2014
Change from single provider to chain provider
@toin0u toin0u merged commit 38ff08f into geocoder-php:master May 12, 2014
@toin0u
Copy link
Member

toin0u commented May 12, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants