Closed pierlon closed 4 years ago
We should also make the fetching of the other settings static (access key and secret key).
We should also make the fetching of the other settings static (access key and secret key).
No we shouldn't static method are really against the point of objects.
Wouldn't it be easier to define this as a constant or a function in the main plugin file?
No we shouldn't static method are really against the point of objects.
Agreed. The issue here is that there is no reason to instantiate these values on every request. They should instead be moved to a class that houses them and are able to be retrieved statically.
Wouldn't it be easier to define this as a constant or a function in the main plugin file?
As stated earlier, I think these values should go into their own class. There's no need to overload the plugin class. Thoughts?
It's own class feels like overkill for something that could be as simple as.
if( defined( 'UNSPLASH_UTM_SOURCE') ) {
define('UNSPLASH_UTM_SOURCE', sanitize_title_with_dashes( get_bloginfo( 'name' ) ));
}
As stated earlier, I think these values should go into their own class. There's no need to overload the plugin class. Thoughts?
Creating a class for this is massively overkill. Adding a new class will take time to setup tests etc. Creating an object take resources and has overhead. Setting up a constant with a option that is already in memory seems to have little downside to me.
Summary
Fixes UVP-180.
Checklist