PHP design pattern implementation