本文整理匯總了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'));
}
示例3: getListenerPriority
public function getListenerPriority($eventName, $listener)
{
$this->lazyLoad($eventName);
return parent::getListenerPriority($eventName, $listener);
}