Let's say I have multiple activities with same events and these events having different parameters in each activity. The question is "Is there any design pattern that particularly cover this matter?"
If I use interfaces
, then I have to have same parameters in event functions. What I need is just insuring of having all event functions with any parameters in each activity.
Example:
class FirstCampaign{
public function onFirstPurchase($arg1,$arg2, User $user){
//
}
public function onFirstTrade($price,$something, User $user,Model $model){
//
}
}
class SecondCampaign{
public function onFirstPurchase(User $user){
//
}
public function onFirstTrade(Model $model){
//
}
}
class ThirdCampaign{
public function onFirstPurchase(User $user, Model $model, int $abc){
//
}
public function onFirstTrade(){
//
}
}
PS. I have tried
onFirstPurchase(...$arguments)
but it's not exactly what I need and it's just too complicated to work with.
PS. I call the events in different part of my application and they are not running under same circumstances.
Aucun commentaire:
Enregistrer un commentaire