What I would like to achieve is to use classes (now two, later more) with different interface the same way, so I would like avoid using decisions based on the interface on upper levels for instance, I don't want to see things like this:
if ($class instanceof 'ThisInterface') {
$thisInterfaceImplementation->doStuff();
}
Instead, I would like to call the method like $class->doStuff() and put the decisions into a wrapper like class. I would like to avoid empty methods also.
I'm thinking about to use Wrapper or Adapter (and maybe Observer), but I'm curious, maybe there is a better way to do this.
To be more clear here is a small explanation what I try to solve. We are building an application that has to communicate with printing houses. This means we have to add an additional page(s) to the print sheets (or not, or maybe different way), maybe we have to rename the pdf files on ftp this or that way, or not at all.
We have a couple decisions to made based on the printers (on our interfaces), but at different steps or processes, therefore I think Strategy pattern wouldn't be a good fit (and I would have to create empty methods or use those ifs)
The Observer pattern seems to solve all my "problems", but it might be an overkill in this case. With this, I could simply dispatch events at the points I have to make a decision and only the observers subscribed to this event would do the necessary things. No empty methods, not much problem with different interfaces. On the other hand, we would dispatch every event only one place in the code, so this seems to be a "miss usage" of this pattern.
Any advice would be appreciated!