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


PHP EventDispatcherInterface::getListenerPriority方法代码示例

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


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

示例1: renderEventListenerTable

 /**
  * @param array $array
  */
 private function renderEventListenerTable(EventDispatcherInterface $eventDispatcher, $event, array $eventListeners, SymfonyStyle $io)
 {
     $tableHeaders = array('Order', 'Callable', 'Priority');
     $tableRows = array();
     $order = 1;
     foreach ($eventListeners as $order => $listener) {
         $tableRows[] = array(sprintf('#%d', $order + 1), $this->formatCallable($listener), $eventDispatcher->getListenerPriority($event, $listener));
     }
     $io->table($tableHeaders, $tableRows);
 }
开发者ID:robhaverkort,项目名称:belasting,代码行数:13,代码来源:TextDescriptor.php

示例2: getEventDispatcherListenersData

 /**
  * @param EventDispatcherInterface $eventDispatcher
  * @param string|null              $event
  *
  * @return array
  */
 private function getEventDispatcherListenersData(EventDispatcherInterface $eventDispatcher, $event = null)
 {
     $data = array();
     $registeredListeners = $eventDispatcher->getListeners($event);
     if (null !== $event) {
         foreach ($registeredListeners as $listener) {
             $l = $this->getCallableData($listener);
             $l['priority'] = $eventDispatcher->getListenerPriority($event, $listener);
             $data[] = $l;
         }
     } else {
         ksort($registeredListeners);
         foreach ($registeredListeners as $eventListened => $eventListeners) {
             foreach ($eventListeners as $eventListener) {
                 $l = $this->getCallableData($eventListener);
                 $l['priority'] = $eventDispatcher->getListenerPriority($eventListened, $eventListener);
                 $data[$eventListened][] = $l;
             }
         }
     }
     return $data;
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:28,代码来源:JsonDescriptor.php

示例3: getListenerPriority

 /**
  * Gets the listener priority for a specific event.
  *
  * Returns null if the event or the listener does not exist.
  *
  * @param string   $eventName The name of the event
  * @param callable $listener  The listener
  *
  * @return int|null The event listener priority
  */
 public function getListenerPriority($eventName, $listener)
 {
     return $this->symfonyDispatcher->getListenerPriority($eventName, $listener);
 }
开发者ID:luizpcam,项目名称:laravel,代码行数:14,代码来源:EventDispatcherAdapter.php

示例4: describeEventDispatcherListeners

 /**
  * {@inheritdoc}
  */
 protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = array())
 {
     $event = array_key_exists('event', $options) ? $options['event'] : null;
     $title = 'Registered listeners';
     if (null !== $event) {
         $title .= sprintf(' for event `%s` ordered by descending priority', $event);
     }
     $this->write(sprintf('# %s', $title) . "\n");
     $registeredListeners = $eventDispatcher->getListeners($event);
     if (null !== $event) {
         foreach ($registeredListeners as $order => $listener) {
             $this->write("\n" . sprintf('## Listener %d', $order + 1) . "\n");
             $this->describeCallable($listener);
             $this->write(sprintf('- Priority: `%d`', $eventDispatcher->getListenerPriority($event, $listener)) . "\n");
         }
     } else {
         ksort($registeredListeners);
         foreach ($registeredListeners as $eventListened => $eventListeners) {
             $this->write("\n" . sprintf('## %s', $eventListened) . "\n");
             foreach ($eventListeners as $order => $eventListener) {
                 $this->write("\n" . sprintf('### Listener %d', $order + 1) . "\n");
                 $this->describeCallable($eventListener);
                 $this->write(sprintf('- Priority: `%d`', $eventDispatcher->getListenerPriority($eventListened, $eventListener)) . "\n");
             }
         }
     }
 }
开发者ID:source-foundry,项目名称:code-corpora,代码行数:30,代码来源:MarkdownDescriptor.php

示例5: appendEventListenerDocument

 /**
  *
  * @param \DOMElement $element
  * @param array $eventListeners
  */
 private function appendEventListenerDocument(EventDispatcherInterface $eventDispatcher, $event, \DOMElement $element, array $eventListeners)
 {
     foreach ($eventListeners as $listener) {
         $callableXML = $this->getCallableDocument($listener);
         $callableXML->childNodes->item(0)->setAttribute('priority', $eventDispatcher->getListenerPriority($event, $listener));
         $element->appendChild($element->ownerDocument->importNode($callableXML->childNodes->item(0), true));
     }
 }
开发者ID:skelpo,项目名称:framework,代码行数:13,代码来源:XmlDescriptor.php


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