public function respond($event, array $data = [])
    {
        $event = (string) $event;

        if (strpos($event, '.') == false) {
            throw new \InvalidArgumentException('The event name is invalid (expecting "action.event")');
        }

        foreach ($this->listeners as $pattern => $listener) {
            if (self::match($pattern, $event)) {
                call_user_func($listener, $data, $event);
            }
        }
    }
public function respond($event, array $data = [])
    {
        $event = (string) $event;

        if (strpos($event, '.') == false) {
            throw new \InvalidArgumentException('The event name is invalid (expecting "action.event")');
        }

        foreach ($this->listeners as $pattern => $listener) {
            if (self::match($pattern, $event)) {
                call_user_func($listener, $data, $event);
            }
        }
    }
public function respond ( $ event , array $ data = [ ] ) { $ event = ( string ) $ event ; if ( strpos ( $ event , '.' ) == false ) { throw new \ InvalidArgumentException ( 'The event name is invalid (expecting "action.event")' ) ; } foreach ( $ this -> listeners as $ pattern => $ listener ) { if ( self :: match ( $ pattern , $ event ) ) { call_user_func ( $ listener , $ data , $ event ) ; } } }
Responds to an event.

@param string $event The name of the event ("action.event")
@param array $data The data for this event (optional)
@throws \InvalidArgumentException if the event name is invalid.
Responds to an event .