当前位置: 首页>>代码示例>>PHP>>正文


PHP EventDispatcher::removeSubscriber方法代码示例

本文整理汇总了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);
 }
开发者ID:gunnartorfis,项目名称:plex_requests,代码行数:12,代码来源:HttpClient.php

示例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));
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:9,代码来源:AbstractEventDispatcherTest.php

示例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]);
         }
     }
 }
开发者ID:gmo,项目名称:common,代码行数:14,代码来源:RouterListener.php

示例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();
 }
开发者ID:luizpcam,项目名称:laravel,代码行数:7,代码来源:AbstractEventDispatcherTest.php


注:本文中的Symfony\Component\EventDispatcher\EventDispatcher::removeSubscriber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。