/** * Notify the event listeners that there's a event, or connection is opened or closed. * * @param Event $event The event object. */ public function notifyEventListeners(Event $event) { $event->setSent(); foreach ($this->eventListeners as $listener) { if ($listener instanceof EventListenerInterface) { $listener->gotEvent($event); } else { if (is_callable($listener)) { $listener($event); } } } }