public function dispatchEvent($name, $event = array())
    {
        $result = array();
        
        //Make sure we have an event object
        if (! $event instanceof AnEvent) {
            $event = new AnEvent($event);
        }
        
        $event->setName($name)->setDispatcher($this);
             
        //Nofity the listeners
        if (isset($this->_listeners[$name])) {
            foreach ($this->_listeners[$name] as $listener) {
                $listener->$name($event);
                
                if (! $event->canPropagate()) {
                    break;
                }
            }
        }
        
        return $this;
    }
public function dispatchEvent($name, $event = array())
    {
        $result = array();
        
        //Make sure we have an event object
        if (! $event instanceof AnEvent) {
            $event = new AnEvent($event);
        }
        
        $event->setName($name)->setDispatcher($this);
             
        //Nofity the listeners
        if (isset($this->_listeners[$name])) {
            foreach ($this->_listeners[$name] as $listener) {
                $listener->$name($event);
                
                if (! $event->canPropagate()) {
                    break;
                }
            }
        }
        
        return $this;
    }
public function dispatchEvent ( $ name , $ event = array ( ) ) { $ result = array ( ) ; //Make sure we have an event object if ( ! $ event instanceof AnEvent ) { $ event = new AnEvent ( $ event ) ; } $ event -> setName ( $ name ) -> setDispatcher ( $ this ) ; //Nofity the listeners if ( isset ( $ this -> _listeners [ $ name ] ) ) { foreach ( $ this -> _listeners [ $ name ] as $ listener ) { $ listener -> $ name ( $ event ) ; if ( ! $ event -> canPropagate ( ) ) { break ; } } } return $ this ; }
Dispatches an event by dispatching arguments to all listeners that handle
the event and returning their return values.

@param   string  The event name
@param   object|array   An array, a AnConfig or a AnEvent object
@return  AnEventDispatcher
Dispatches an event by dispatching arguments to all listeners that handle the event and returning their return values .