當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。