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


PHP Enlight_Event_EventArgs::setName方法代码示例

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


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

示例1: collect

 /**
  * Event which is fired to collect plugin parameters
  * to register additionally application components or configurations.
  *
  * @param                 $event
  * @param ArrayCollection $collection
  * @param null            $eventArgs
  *
  * @throws Enlight_Event_Exception
  * @return ArrayCollection|null
  */
 public function collect($event, ArrayCollection $collection, $eventArgs = null)
 {
     if (!$this->hasListeners($event)) {
         return $collection;
     }
     if (isset($eventArgs) && is_array($eventArgs)) {
         $eventArgs = new Enlight_Event_EventArgs($eventArgs);
     } elseif (!isset($eventArgs)) {
         $eventArgs = new Enlight_Event_EventArgs();
     } elseif (!$eventArgs instanceof Enlight_Event_EventArgs) {
         throw new Enlight_Event_Exception('Parameter "eventArgs" must be an instance of "Enlight_Event_EventArgs"');
     }
     $eventArgs->setName($event);
     $eventArgs->setProcessed(false);
     foreach ($this->getListeners($event) as $listener) {
         $listenerCollection = $listener->execute($eventArgs);
         if ($listenerCollection instanceof ArrayCollection) {
             foreach ($listenerCollection->getValues() as $value) {
                 $collection->add($value);
             }
         } elseif ($listenerCollection !== null) {
             $collection->add($listenerCollection);
         }
     }
     $eventArgs->setProcessed(true);
     return $collection;
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:38,代码来源:EventManager.php

示例2: filter

 /**
  * Checks if the event has registered listeners.
  * If the event has listeners this listeners will be executed with the given event arguments.
  * The event arguments have to been an array or an instance of the Enlight_Event_EventArgs class.
  * If the given arguments not an array or an instance of the Enlight_Event_EventArgs class enlight
  * throw an Enlight_Event_Exception.
  * Before the listener will be executed the the flag "processed" will be set to false in the event arguments.
  * After all event listeners has been executed the "processed" flag will be set to true.
  *
  * The return value of the execute method will be set in the event arguments return value.
  *
  * @throws  Enlight_Event_Exception
  * @param   string $event
  * @param   mixed $value
  * @param   Enlight_Event_EventArgs|array|null $eventArgs
  * @return  mixed
  */
 public function filter($event, $value, $eventArgs = null)
 {
     if (!$this->hasListeners($event)) {
         return $value;
     }
     if (isset($eventArgs) && is_array($eventArgs)) {
         $eventArgs = new Enlight_Event_EventArgs($eventArgs);
     } elseif (!isset($eventArgs)) {
         $eventArgs = new Enlight_Event_EventArgs();
     } elseif (!$eventArgs instanceof Enlight_Event_EventArgs) {
         throw new Enlight_Event_Exception('Parameter "eventArgs" must be an instance of "Enlight_Event_EventArgs"');
     }
     $eventArgs->setReturn($value);
     $eventArgs->setName($event);
     $eventArgs->setProcessed(false);
     foreach ($this->getListeners($event) as $listener) {
         if (null !== ($return = $listener->execute($eventArgs))) {
             $eventArgs->setReturn($return);
         }
     }
     $eventArgs->setProcessed(true);
     return $eventArgs->getReturn();
 }
开发者ID:nhp,项目名称:shopware-4,代码行数:40,代码来源:EventManager.php


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