public function fireEvent($event, $params = [], $halt = FALSE)
    {
        if (!is_array($params)) $params = [$params];
        $result = [];

        // Single events
        if (isset($this->emitterSingleEvents[$event])) {
            foreach ($this->emitterSingleEvents[$event] as $callback) {
                $response = call_user_func_array($callback, $params);
                if (is_null($response)) continue;
                if ($halt) return $response;
                $result[] = $response;
            }

            unset($this->emitterSingleEvents[$event]);
        }

        // Recurring events, with priority
        if (isset($this->emitterEvents[$event])) {

            if (!isset($this->emitterEventSorted[$event]))
                $this->emitterEventSortEvents($event);

            foreach ($this->emitterEventSorted[$event] as $callback) {
                $response = call_user_func_array($callback, $params);
                if (is_null($response)) continue;
                if ($halt) return $response;
                $result[] = $response;
            }
        }

        return $halt ? null : $result;
    }
public function fireEvent($event, $params = [], $halt = FALSE)
    {
        if (!is_array($params)) $params = [$params];
        $result = [];

        // Single events
        if (isset($this->emitterSingleEvents[$event])) {
            foreach ($this->emitterSingleEvents[$event] as $callback) {
                $response = call_user_func_array($callback, $params);
                if (is_null($response)) continue;
                if ($halt) return $response;
                $result[] = $response;
            }

            unset($this->emitterSingleEvents[$event]);
        }

        // Recurring events, with priority
        if (isset($this->emitterEvents[$event])) {

            if (!isset($this->emitterEventSorted[$event]))
                $this->emitterEventSortEvents($event);

            foreach ($this->emitterEventSorted[$event] as $callback) {
                $response = call_user_func_array($callback, $params);
                if (is_null($response)) continue;
                if ($halt) return $response;
                $result[] = $response;
            }
        }

        return $halt ? null : $result;
    }
public function fireEvent ( $ event , $ params = [ ] , $ halt = FALSE ) { if ( ! is_array ( $ params ) ) $ params = [ $ params ] ; $ result = [ ] ; // Single events if ( isset ( $ this -> emitterSingleEvents [ $ event ] ) ) { foreach ( $ this -> emitterSingleEvents [ $ event ] as $ callback ) { $ response = call_user_func_array ( $ callback , $ params ) ; if ( is_null ( $ response ) ) continue ; if ( $ halt ) return $ response ; $ result [ ] = $ response ; } unset ( $ this -> emitterSingleEvents [ $ event ] ) ; } // Recurring events, with priority if ( isset ( $ this -> emitterEvents [ $ event ] ) ) { if ( ! isset ( $ this -> emitterEventSorted [ $ event ] ) ) $ this -> emitterEventSortEvents ( $ event ) ; foreach ( $ this -> emitterEventSorted [ $ event ] as $ callback ) { $ response = call_user_func_array ( $ callback , $ params ) ; if ( is_null ( $ response ) ) continue ; if ( $ halt ) return $ response ; $ result [ ] = $ response ; } } return $ halt ? null : $ result ; }
Fire an event and call the listeners.

@param string $event Event name
@param array $params Event parameters
@param boolean $halt Halt after first non-null result

@return string|array Collection of event results / Or single result (if halted)
Fire an event and call the listeners .