[SOLVED] Help me condense this rule

I suggest this design pattern to start with: