I think it's nice to have something like this in PEAR, but I'd also like it to have some more complex features:
- Observers should be able to actually cancel the event, like when a form is submitted, any object may actually cancel this so the form is not processed. I need this a lot my my projects, where I use it to add some additional checks prior to actually submitting an order (I have to events, onBeforeOrder and onOrder which I can hook into)
- Event bubbling, which allows you to nest Notification Centers, I've done this for patPortal, where a component may trigger an event which can either be handled by event listeners registered for the component or event listeners registered for the area or page that contains the component
I'd happily contribute these features to the project, so I'd be able to use it in my own projects.
It would also be nice to have a method which allows you to register and observer by reference, otherwise some object references will get lost...
And here you need an ampersand:
$notification = new Event_Notification($object, $nName, $info);