本文整理汇总了PHP中Symfony\Component\EventDispatcher\EventDispatcher::removeSubscriber方法的典型用法代码示例。如果您正苦于以下问题:PHP EventDispatcher::removeSubscriber方法的具体用法?PHP EventDispatcher::removeSubscriber怎么用?PHP EventDispatcher::removeSubscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\EventDispatcher\EventDispatcher
的用法示例。
在下文中一共展示了EventDispatcher::removeSubscriber方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeSubscriber
/**
* Remove a subscriber
*
* @param EventSubscriberInterface $subscriber
*/
public function removeSubscriber(EventSubscriberInterface $subscriber)
{
if ($subscriber instanceof HttpClientEventSubscriber) {
$subscriber->attachHttpClient($this);
}
$this->eventDispatcher->removeSubscriber($subscriber);
}
示例2: testRemoveSubscriberWithMultipleListeners
public function testRemoveSubscriberWithMultipleListeners()
{
$eventSubscriber = new TestEventSubscriberWithMultipleListeners();
$this->dispatcher->addSubscriber($eventSubscriber);
$this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
$this->assertCount(2, $this->dispatcher->getListeners(self::preFoo));
$this->dispatcher->removeSubscriber($eventSubscriber);
$this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
}
示例3: removeOldListener
/**
* Removes old listener from dispatcher
*
* @param EventDispatcher $dispatcher
*/
private function removeOldListener(EventDispatcher $dispatcher)
{
$listeners = $dispatcher->getListeners(KernelEvents::REQUEST);
foreach ($listeners as $listener) {
if (is_array($listener) && $listener[0] instanceof RouterListenerBase) {
$dispatcher->removeSubscriber($listener[0]);
}
}
}
示例4: it_removes_subscriptions_from_the_symfony_dispathcer
/** @test */
public function it_removes_subscriptions_from_the_symfony_dispathcer()
{
$subscriber = $this->prophesize('Symfony\\Component\\EventDispatcher\\EventSubscriberInterface');
$this->dispatcher->removeSubscriber($subscriber->reveal());
$this->symfony->removeSubscriber($subscriber->reveal())->shouldHaveBeenCalled();
}