PHP implementation of observer pattern