Webmozart\Console\Api\Config\ApplicationConfig::setEventDispatcher PHP 메소드

setEventDispatcher() 공개 메소드

Sets the event dispatcher for dispatching the console events.
public setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null ) : static
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface The event dispatcher.
리턴 static The current instance.
    public function setEventDispatcher(EventDispatcherInterface $dispatcher = null)
    {
        $this->dispatcher = $dispatcher;
        return $this;
    }

Usage Example

예제 #1
0
 public function testRemoveEventSubscriber()
 {
     $dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $subscriber = $this->getMock('Symfony\\Component\\EventDispatcher\\EventSubscriberInterface');
     $dispatcher->expects($this->once())->method('removeSubscriber')->with($subscriber);
     $this->config->setEventDispatcher($dispatcher);
     $this->config->removeEventSubscriber($subscriber);
 }