src/Common/Service/Event.php
public function trigger($sEvent, $sNamespace = 'nails/common', $aData = [])
    {
        $this->addHistory($sEvent, $sNamespace);

        $sEvent     = strtoupper($sEvent);
        $sNamespace = strtoupper($sNamespace);

        if (!empty($this->aSubscriptions[$sNamespace][$sEvent])) {
            foreach ($this->aSubscriptions[$sNamespace][$sEvent] as $sSubscriptionHash => $oSubscription) {
                if (is_callable($oSubscription->callback)) {
                    call_user_func_array($oSubscription->callback, $aData);
                }

                if ($oSubscription->is_once) {
                    unset($this->aSubscriptions[$sNamespace][$sEvent][$sSubscriptionHash]);
                }
            }
        }

        return $this;
    }
public function trigger($sEvent, $sNamespace = 'nails/common', $aData = [])
    {
        $this->addHistory($sEvent, $sNamespace);

        $sEvent     = strtoupper($sEvent);
        $sNamespace = strtoupper($sNamespace);

        if (!empty($this->aSubscriptions[$sNamespace][$sEvent])) {
            foreach ($this->aSubscriptions[$sNamespace][$sEvent] as $sSubscriptionHash => $oSubscription) {
                if (is_callable($oSubscription->callback)) {
                    call_user_func_array($oSubscription->callback, $aData);
                }

                if ($oSubscription->is_once) {
                    unset($this->aSubscriptions[$sNamespace][$sEvent][$sSubscriptionHash]);
                }
            }
        }

        return $this;
    }
public function trigger ( $ sEvent , $ sNamespace = 'nails/common' , $ aData = [ ] ) { $ this -> addHistory ( $ sEvent , $ sNamespace ) ; $ sEvent = strtoupper ( $ sEvent ) ; $ sNamespace = strtoupper ( $ sNamespace ) ; if ( ! empty ( $ this -> aSubscriptions [ $ sNamespace ] [ $ sEvent ] ) ) { foreach ( $ this -> aSubscriptions [ $ sNamespace ] [ $ sEvent ] as $ sSubscriptionHash => $ oSubscription ) { if ( is_callable ( $ oSubscription -> callback ) ) { call_user_func_array ( $ oSubscription -> callback , $ aData ) ; } if ( $ oSubscription -> is_once ) { unset ( $ this -> aSubscriptions [ $ sNamespace ] [ $ sEvent ] [ $ sSubscriptionHash ] ) ; } } } return $ this ; }
Trigger the event and execute all callbacks

@param  string $sEvent     The event to trigger
@param  string $sNamespace The event's namespace
@param  array  $aData      Data to pass to the callbacks

@return \Nails\Common\Service\Event
Trigger the event and execute all callbacks