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


PHP Event::getName方法代码示例

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


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

示例1: dispatch

 /**
  * @inheritdoc
  */
 public function dispatch(Event $event)
 {
     if (isset($this->listeners[$event->getName()])) {
         foreach ($this->listeners[$event->getName()] as $listener) {
             call_user_func($listener, $event);
         }
     }
 }
开发者ID:angelk,项目名称:tmp-bships,代码行数:11,代码来源:EventDispatcher.php

示例2: dispatch

 public function dispatch(Event $event)
 {
     if (empty($this->listeners[$event->getName()])) {
         return;
     }
     foreach ($this->listeners[$event->getName()] as $listener) {
         call_user_func($listener, $event);
     }
 }
开发者ID:docteurklein,项目名称:event-store,代码行数:9,代码来源:Dispatcher.php

示例3: attach

 /**
  * @param \Event $event
  */
 public static function attach(\Event $event)
 {
     if ($event->ready) {
         if (!isset(self::$events[$event->getName()])) {
             self::$events[$event->getName()] = [];
         }
         if (!is_array(self::$events[$event->getName()])) {
             self::$events[$event->getName()] = [];
         }
         self::$events[$event->getName()][] = $event;
     }
 }
开发者ID:jankal,项目名称:mvc,代码行数:15,代码来源:EventHandler.php

示例4: getEventName

 /**
  * @param string|Event $event
  * @return string
  */
 protected function getEventName($event)
 {
     if ($event instanceof Event) {
         return $event->getName();
     }
     return $event;
 }
开发者ID:lytc,项目名称:sloths,代码行数:11,代码来源:ObserverTrait.php

示例5: apply

 public function apply(Event $event)
 {
     $method = 'apply' . $event->getName();
     if (method_exists($this, $method)) {
         $this->{$method}($event);
     }
 }
开发者ID:cocoders,项目名称:event-store,代码行数:7,代码来源:AggregateRootBehavior.php

示例6: trigger

 /**
  * Trigger event
  * @api
  * @param string $event
  * @param string|object $target
  * @param array|object $params
  * @return string|object
  */
 public function trigger($event, $target = null, $params = null)
 {
     if (!$event instanceof Event) {
         $event = new Event($event, $target, $params);
     }
     if (strstr($event->getName(), ':')) {
         $namespace = substr($event->getName(), 0, strpos($event->getName(), ':'));
         if (isset($this->listeners[$namespace])) {
             $this->fire($this->listeners[$namespace], $event);
         }
     }
     if (isset($this->listeners[$event->getName()])) {
         $this->fire($this->listeners[$event->getName()], $event);
     }
     return $event->getTarget();
 }
开发者ID:9618211,项目名称:framework,代码行数:24,代码来源:EventManager.php

示例7: filter

 /**
  * Filters a value by calling all listeners of a given event.
  *
  * @param  sfEvent  $event   A sfEvent instance
  * @param  mixed    $value   The value to be filtered
  *
  * @return sfEvent The sfEvent instance
  */
 public function filter(Event $event, $value)
 {
     foreach ($this->getListeners($event->getName()) as $listener) {
         $value = call_user_func_array($listener, array($event, $value));
     }
     $event->setReturnValue($value);
     return $event;
 }
开发者ID:nebtrx,项目名称:stratos,代码行数:16,代码来源:EventDispatcher.php

示例8: fire

 public function fire(Event $event)
 {
     $name = $event->getName();
     if (!in_array($name, $this->events)) {
         return;
     }
     call_user_func($this->closure, $event);
 }
开发者ID:veloxpro,项目名称:VeloxPHP,代码行数:8,代码来源:EventListener.php

示例9: addEvent

 /**
  * @return null
  */
 public function addEvent(Event $event)
 {
     $name = $event->getName();
     if (!$this->hasEvent($name)) {
         $this->events[$name] = [];
     }
     $this->events[$name][] = $event;
 }
开发者ID:wispira,项目名称:framework,代码行数:11,代码来源:Manager.php

示例10: encoder_redirect_success

function encoder_redirect_success(Event $new_Event)
{
    $new_Event_name = $new_Event->getName();
    $dir = "VIEW/html/Encoder/Add_Event/Event_List.php?success_edit=1";
    $url = BASE_URL . $dir;
    header("Location:{$url}");
    //redirect the encoder to the Events add place
    exit;
}
开发者ID:rogermule,项目名称:afalagi-web,代码行数:9,代码来源:Edit_Event.php

示例11: testConstruct

 /**
  * @covers Panadas\Event\Event::__construct()
  * @covers Panadas\Event\Event::getName()
  * @covers Panadas\Event\Event::setName()
  * @covers Panadas\Event\Event::getPublisher()
  * @covers Panadas\Event\Event::setPublisher()
  * @covers Panadas\Event\Event::getParams()
  * @covers Panadas\Event\Event::setParams()
  */
 public function testConstruct()
 {
     $name = "foo";
     $publisher = new Publisher();
     $params = ["paramkey" => "paramvalue"];
     $event = new Event($name, $publisher, $params);
     $this->assertEquals($name, $event->getName());
     $this->assertInstanceOf("Panadas\\Event\\DataStructure\\EventParams", $event->getParams());
     $this->assertSame($publisher, $event->getPublisher());
 }
开发者ID:panadas,项目名称:event,代码行数:19,代码来源:EventTest.php

示例12: fireEvent

 private function fireEvent(Event $event)
 {
     $listeners = $this->getListeners($event->getName());
     if (!$listeners) {
         return;
     }
     foreach ($listeners as $listener) {
         $listener->handle($event);
     }
 }
开发者ID:sdlyhu,项目名称:laravelio,代码行数:10,代码来源:Dispatcher.php

示例13: encoder_redirect_success

function encoder_redirect_success(Event $event)
{
    $Name = $event->getName();
    $Name_Amharic = $event->getNameAmharic();
    $dir = "VIEW/html/Encoder/Add_Event/Add_Events.php?success=1&Name={$Name}&Name_Amharic={$Name_Amharic}";
    $url = BASE_URL . $dir;
    header("Location:{$url}");
    //redirect the encoder to the regions add place
    exit;
}
开发者ID:rogermule,项目名称:afalagi-web,代码行数:10,代码来源:Add_Event.php

示例14: broadcast

 public function broadcast(Event $event)
 {
     $name = $event->getName();
     if (!isset($this->listeners[$name])) {
         return;
     }
     foreach ($this->listeners[$name] as $listener) {
         if ($event->isPropagationStopped()) {
             break;
         }
         $listener->fire($event);
     }
 }
开发者ID:veloxpro,项目名称:VeloxPHP,代码行数:13,代码来源:EventManager.php

示例15: triggerEvent

 public function triggerEvent(Event $event)
 {
     $eventName = $event->getName();
     if (!isset($this->handlers[$eventName])) {
         return $event;
     }
     foreach ($this->handlers[$eventName] as $handler) {
         $handler->handle($event);
         if ($event->isCancelled()) {
             break;
         }
     }
     return $event;
 }
开发者ID:ofeige,项目名称:opf,代码行数:14,代码来源:Dispatcher.php


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