public function addEventListener($eventName, $listener, $priority = 0)
    {
        if (!$this->dispatcher) {
            $this->dispatcher = new EventDispatcher();
        }

        $this->dispatcher->addListener($eventName, $listener, $priority);

        return $this;
    }
public function addEventListener($eventName, $listener, $priority = 0)
    {
        if (!$this->dispatcher) {
            $this->dispatcher = new EventDispatcher();
        }

        $this->dispatcher->addListener($eventName, $listener, $priority);

        return $this;
    }
public function addEventListener ( $ eventName , $ listener , $ priority = 0 ) { if ( ! $ this -> dispatcher ) { $ this -> dispatcher = new EventDispatcher ( ) ; } $ this -> dispatcher -> addListener ( $ eventName , $ listener , $ priority ) ; return $ this ; }
Adds a listener for the given event name.

See {@link ConsoleEvents} for the supported event names.

@param string   $eventName The event to listen to.
@param callable $listener  The callback to execute when the event is
dispatched.
@param int      $priority  The event priority.

@return static The current instance.

@see EventDispatcherInterface::addListener()
Adds a listener for the given event name .