public function addEventSubscriber(EventSubscriberInterface $subscriber)
    {
        if (!$this->dispatcher) {
            $this->dispatcher = new EventDispatcher();
        }

        $this->dispatcher->addSubscriber($subscriber);

        return $this;
    }
public function addEventSubscriber(EventSubscriberInterface $subscriber)
    {
        if (!$this->dispatcher) {
            $this->dispatcher = new EventDispatcher();
        }

        $this->dispatcher->addSubscriber($subscriber);

        return $this;
    }
public function addEventSubscriber ( EventSubscriberInterface $ subscriber ) { if ( ! $ this -> dispatcher ) { $ this -> dispatcher = new EventDispatcher ( ) ; } $ this -> dispatcher -> addSubscriber ( $ subscriber ) ; return $ this ; }
Adds an event subscriber to the dispatcher.

@param EventSubscriberInterface $subscriber The subscriber to add.

@return static The current instance.

@see EventDispatcherInterface::addSubscriber()
Adds an event subscriber to the dispatcher .