public function trigger($event, $params = array()) {
        $eventObject = is_object($event) ? $event : new GenericEvent($event, $params);
        foreach ($this->getListeners($eventObject) as $callback) {
            if (is_array($callback) && count($callback) == 2) {
                list($key, $function) = $callback;
                if (is_string($key) && !class_exists($key) && $this->getServiceManager()->has($key)) {
                    $service = $this->getServiceManager()->get($key);
                    $callback = [$service, $function];
                }
            }
            call_user_func($callback, $eventObject);
        }
    }
public function trigger($event, $params = array()) {
        $eventObject = is_object($event) ? $event : new GenericEvent($event, $params);
        foreach ($this->getListeners($eventObject) as $callback) {
            if (is_array($callback) && count($callback) == 2) {
                list($key, $function) = $callback;
                if (is_string($key) && !class_exists($key) && $this->getServiceManager()->has($key)) {
                    $service = $this->getServiceManager()->get($key);
                    $callback = [$service, $function];
                }
            }
            call_user_func($callback, $eventObject);
        }
    }
public function trigger ( $ event , $ params = array ( ) ) { $ eventObject = is_object ( $ event ) ? $ event : new GenericEvent ( $ event , $ params ) ; foreach ( $ this -> getListeners ( $ eventObject ) as $ callback ) { if ( is_array ( $ callback ) && count ( $ callback ) == 2 ) { list ( $ key , $ function ) = $ callback ; if ( is_string ( $ key ) && ! class_exists ( $ key ) && $ this -> getServiceManager ( ) -> has ( $ key ) ) { $ service = $ this -> getServiceManager ( ) -> get ( $ key ) ; $ callback = [ $ service , $ function ] ; } } call_user_func ( $ callback , $ eventObject ) ; } }
Dispatch an event and trigger its listeners

@param mixed $event either an Event object or a string
@param array $params
Dispatch an event and trigger its listeners