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

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

        $action = substr($event, 0, $pos);

        if (!isset($this->responders[$action])) {
            return;
        }

        if (isset($this->data[$action])) {
            $data = array_merge($this->data[$action], $data);
        }

        foreach ($this->responders[$action] as $responder) {
            if ($responder instanceof ResponderInterface) {
                $responder->respond($event, $data);
            } elseif (is_callable($responder)) {
                $responder($event, $data);
            }
        }
    }
public function notify($event, array $data = [])
    {
        $event = (string) $event;

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

        $action = substr($event, 0, $pos);

        if (!isset($this->responders[$action])) {
            return;
        }

        if (isset($this->data[$action])) {
            $data = array_merge($this->data[$action], $data);
        }

        foreach ($this->responders[$action] as $responder) {
            if ($responder instanceof ResponderInterface) {
                $responder->respond($event, $data);
            } elseif (is_callable($responder)) {
                $responder($event, $data);
            }
        }
    }
public function notify ( $ event , array $ data = [ ] ) { $ event = ( string ) $ event ; if ( ( $ pos = strpos ( $ event , '.' ) ) == false ) { throw new \ InvalidArgumentException ( 'The event name is invalid (expecting "action.event")' ) ; } $ action = substr ( $ event , 0 , $ pos ) ; if ( ! isset ( $ this -> responders [ $ action ] ) ) { return ; } if ( isset ( $ this -> data [ $ action ] ) ) { $ data = array_merge ( $ this -> data [ $ action ] , $ data ) ; } foreach ( $ this -> responders [ $ action ] as $ responder ) { if ( $ responder instanceof ResponderInterface ) { $ responder -> respond ( $ event , $ data ) ; } elseif ( is_callable ( $ responder ) ) { $ responder ( $ event , $ data ) ; } } }
Notifies the observer of an event.

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