The PxEventObserver Class
PxEventObserver: Handle events fired by a subject
Interface that should be implemented by objects that want to be notified about events. When you want to listen
to events that are fired by an object that implements the PxEventSubject interface, you can do so by calling
the method PxEventSubject::attach() method and register an object that will be notified when a certain event
occurs. The object that you want to attach to the PxEventSubject should implement this PxEventObserver
interface.
to events that are fired by an object that implements the PxEventSubject interface, you can do so by calling
the method PxEventSubject::attach() method and register an object that will be notified when a certain event
occurs. The object that you want to attach to the PxEventSubject should implement this PxEventObserver
interface.
Examples
Example
How to handle a event
// Implements the PxEventObserver to be able to handle events
class SomeClass implements PxEventObserver
{
// implement the handleEvent function
public function handleEvent(PxEvent $event)
{
// check if the incoming event is a event that we can handle
if ($event->name() != "someevent") return;
// react on the event
}
}
