I have a design problem where my classes are set up in such a way:
abstract class Advertiser abstract class AdvertiserCampaign
| |
| |
class AdvUno extends Advertiser class AdvUnoCampaign extends AdvertiserCampaign
class AdvDos extends Advertiser class AdvDosCampaign extends AdvertiserCampaign
class AdvTre extends Advertiser class AdvTreCampaign extends AdvertiserCampaign
The problem is that AdvUno
and AdvUnoCampaign
both need a special authentication method that's not necessary for the others. Right now I've placed it in AdvUno
, but again, it'll be needed by AdvUnoCampaign
(and a bunch of other classes that are set up in this way).
- I can't make
AdvUnoCampaign
extendAdvUno
since there's no multiple inheritance in PHP, but also because it's just generally not a good, clean design practice. - If I make
AdvertiserCampaign
extendAdvertiser
, then all of the extending classes below (AdvUnoCampaign
,AdvDosCampaign
, etc) must implement a bunch of abstract methods that are of no concern to them, and which are already implemented in each of theAdvertiser
classes.
In short, what's the best design practice in this sort of situation? I'd rather not just copy and paste the code into all of the AdvOne
classes. Any help or advice would be appreciated. Thanks!