alcohol / iso3166

A PHP library providing ISO 3166-1 data.
https://iso3166.thephpleague.com
MIT License
640 stars 59 forks source link

getBy*() performance improvements #12

Closed nikolaposa closed 8 years ago

nikolaposa commented 8 years ago

Intent of this PR is to slightly improve performance of getBy*() methods, particularly getByNumeric(), by reducing number of strcasecmp() invocations down to one.

Also, internal get() method now has more cleaner interface (renamed to getBy($key, $value)).

Notice: These modifications introduce BC break.

alcohol commented 8 years ago

To avoid the BC break you could instead add the getBy method, and leave the get() method as is (but mark it deprecated). If you go down that path, add getBy with visibility private please :-)

nikolaposa commented 8 years ago

Yeah, I agree, I was also thinking about making class final. :) So what you do you think, should this PR go towards BC break or you would like to have these changes in some near future release?

alcohol commented 8 years ago

Would prefer my suggestion. :-)

alcohol commented 8 years ago

Thank you :-)