Call us: 0031 23-75-10500  |  Language: Dutch English German
 
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.

Synopsis


Class PxEventObserver

Methods

public mixed PxEventObserver::handleEvent ( PxEvent $event )

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
    }
}