Closed otzy closed 9 years ago
Why not submit a PR for adding a missing Emarsys API method instead? :wink:
well, I'll submit, but still if send() is available you don't need to wait the next release or update composer. Also it's good if you want to override default behavior, for example, throw exception if response is not "OK"
"Send" is an internal method and I believe making it protected will break an open/closed principe along with a bunch of security practices.
I think this completely conforms that principle. If someone needs something different in this method, he writes a new class were method can be extended. If method is private you need to change the source code of SDK, thus breaking open close principle and being forced to support and develop own fork of the library.
Making "send" method protected will open it for modification and that it a violation of open/closed principle.
"closed for modifications" means that you as library author are not allowed to change behavior. You can only fix bugs. So applications that are using your class will not be screwed up by the new version. So it's not about private/protected, it's about approach. "open" means that behavior can be changed through inheritance. And now I'm not able to have an advantage of this part of principle :)
I agree with @otzy on this one. We already argue on this, and I said that I will let it private until someone else find the need to override it. So let it be overridable.
this allows in the descendent class to add emarsys api methods, which are not implemented in this sdk