public function onEvent(Event $event = null)
    {
        while (!empty($this->messages)) {
            $message = array_shift($this->messages);

            $this->handle($message, $this->dispatcher);
        }
    }
public function onEvent(Event $event = null)
    {
        while (!empty($this->messages)) {
            $message = array_shift($this->messages);

            $this->handle($message, $this->dispatcher);
        }
    }
public function onEvent ( Event $ event = null ) { while ( ! empty ( $ this -> messages ) ) { $ message = array_shift ( $ this -> messages ) ; $ this -> handle ( $ message , $ this -> dispatcher ) ; } }
Listen on any event and handle the messages.

Actually, an event is not necessary, you can call this method manually, to.
The event is not processed in any way.

@param Event|null $event
Listen on any event and handle the messages .