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