-
Notifications
You must be signed in to change notification settings - Fork 523
[WIP] Extend #357 #359
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
[WIP] Extend #357 #359
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FQCN is not needed here ;)
b8d76a9 to
65768bb
Compare
|
More work in progress pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a dot to much.
|
Really cool work! Looking forward! |
|
You're doing a great job @willdurand . I have a minor suggestion. The constructor of an Then, to avoid code duplication, you may just use a simple trait in the subclasses which add setAdapter/getAdapter. |
|
Thank you! As for the |
|
@willdurand as you bump the php version to 5.4, why not add a |
|
To be honest, I don't like traits. |
|
@willdurand I agree with you that traits are not that cool, but are a decent alternative of having a complex hierarchy (in this case by having two abstract class |
|
@willdurand Yeah, traits are not the best OOP way, but it would be the easiest way. If you have a better option, let me know :) |
|
Traits are cool, but I neither don't like them for constructors. |
|
@MattKetmo I never meant for constructors: that would be really odd 8-/. Just for protected property + setter/getter... |
|
I agree with @giosh94mhz . The trait should be a |
|
Indeed, I didn't read your last phrase about the |
|
@MattKetmo maybe you're right. Since this is geocoder (not geocoder-bundle, which has DI), using setter/getter imply that the dependency is optional; this doesn't really make sense for remote-providers (I smell "if-null-throw" sanity checks). Do you agree @Baachi ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to throw an exception, if getLimit returns a value lower than 0.
|
@giosh94mhz Yeah i agree with you. So lets create an |
This PR is based on @MattKetmo's work. His initial idea was a sort of eye-opener to me, hence this PR. I removed useless methods in the AbstractProvider. I believe we could have a AbstractLocaleAwareProvider too. The LocaleAwareProvider interface does not make much sense at this point, I'd drop it. The ProviderBasedGeocoder should be an aggregator or proxy. The codebase is getting more and more readable and clean. Edit: I chose to keep the LocaleAwareProvider interface as it is a pretty common use case.
b708519 to
49afa04
Compare
|
Ok so I finished most of the work here, but some tests are failing because we have to rewrite them. I am going to merge it right now. Then, @Baachi @toin0u I'd love your help on fixing the test suite. It is a matter of rewriting test cases, because results were array-based, and now we have an |
|
Anyone willing to contribute the |
This PR is based on @MattKetmo's work. His initial idea was a sort of eye-opener to me, hence this PR.
I removed useless methods in the
AbstractProvider. I believe we could have aAbstractLocaleAwareProvidertoo.TheLocaleAwareProviderinterface does not make much sense at this point, I'd drop it.The
ProviderBasedGeocodershould be an aggregator or proxy.The codebase is getting more and more readable and clean.
Edit: I chose to keep the
LocaleAwareProviderinterface as it is a pretty common use case.