-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[PHP] By default should use static Configuration class instance #19775
Conversation
…new instance is created every time
please update the sample when you've time |
@wing328 could you please do this for me? |
I'm OK with this change, using static methods and properties is a code smell in 99% of the cases, but here the assumption is you should get the (supposedly pre-configured) default config instead of just an empty config object. Not because of performance but because of the behavior, the solution is still the same. 👍 |
Yes exactly. Normally because Configuration is static object, then it's meant to be pre-configured and then can be automatically be reused in all API calls done later in code.
|
no worry i'll update the sample over the weekend and get this PR merged have a nice weekend |
tested updated samples locally and the result is good
will update the samples after merging this PR into master thanks again for the PR |
For PHP.
By default should use static Configuration class instance, otherwise new instance is created every time you make an API call.
Before this PR every time you create new API object and do not pass Configuration object as 2nd argument to API class constructor it creates new Configuration instance. This is wrong, because Configuration class is meant to be Singleton - so
Configuration::getDefaultConfiguration()
should be used instead.Please review: @jebentier @dkarlovi @mandrean @jfastnacht @ybelenko @renepardon