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


PHP EventDispatcher::getListenerPriority方法代码示例

本文整理汇总了PHP中Symfony\Component\EventDispatcher\EventDispatcher::getListenerPriority方法的典型用法代码示例。如果您正苦于以下问题:PHP EventDispatcher::getListenerPriority方法的具体用法?PHP EventDispatcher::getListenerPriority怎么用?PHP EventDispatcher::getListenerPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\EventDispatcher\EventDispatcher的用法示例。


在下文中一共展示了EventDispatcher::getListenerPriority方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetListenerPriority

 public function testGetListenerPriority()
 {
     $listener1 = new TestEventListener();
     $listener2 = new TestEventListener();
     $this->dispatcher->addListener('pre.foo', $listener1, -10);
     $this->dispatcher->addListener('pre.foo', $listener2);
     $this->assertSame(-10, $this->dispatcher->getListenerPriority('pre.foo', $listener1));
     $this->assertSame(0, $this->dispatcher->getListenerPriority('pre.foo', $listener2));
     $this->assertNull($this->dispatcher->getListenerPriority('pre.bar', $listener2));
     $this->assertNull($this->dispatcher->getListenerPriority('pre.foo', function () {
     }));
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:12,代码来源:AbstractEventDispatcherTest.php

示例2: it_asks_the_symfony_dispatcher_for_a_listeners_priority

 /**
  * @test
  * We are not checking Laravel's listeners as its interface does not contain a getListenerPriority function
  */
 public function it_asks_the_symfony_dispatcher_for_a_listeners_priority()
 {
     $this->symfony->getListenerPriority(static::EVENT, 'listener')->willReturn(100);
     $this->assertEquals(100, $this->dispatcher->getListenerPriority(static::EVENT, 'listener'));
 }
开发者ID:luizpcam,项目名称:laravel,代码行数:9,代码来源:AbstractEventDispatcherTest.php

示例3: getListenerPriority

 public function getListenerPriority($eventName, $listener)
 {
     $this->lazyLoad($eventName);
     return parent::getListenerPriority($eventName, $listener);
 }
开发者ID:mlechapt,项目名称:gift-Anonymous,代码行数:5,代码来源:classes.php


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