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


PHP SplSubject::getEvent方法代码示例

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


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

示例1: update

 /**
  * Receive update from subject
  *
  * @param SplSubject $subject Subject observed that contains event to write
  *
  * @return void
  */
 public function update(SplSubject $subject)
 {
     $this->subject = $subject;
     $event = $subject->getEvent();
     // delegate to right event implementation
     call_user_func(array($this, $event->getName()), $event);
 }
开发者ID:remicollet,项目名称:php-compat-info,代码行数:14,代码来源:Console.php

示例2: update

 /**
  * Receive update from subject
  *
  * @param SplSubject $subject Subject observed that contains event to write
  *
  * @return void
  */
 public function update(SplSubject $subject)
 {
     $this->subject = $subject;
     $event = $subject->getEvent();
     // delegate to right event implementation
     $data = call_user_func(array($this, $event->getName()), $event);
     error_log(sprintf('%s [%s] %s %s', strftime($this->timeFormat, $data['timestamp']), $data['level'], $data['message'], PHP_EOL), 3, $this->destFile);
 }
开发者ID:remicollet,项目名称:php-compat-info,代码行数:15,代码来源:File.php

示例3: update

 /**
  * Receive update from subject
  *
  * @param SplSubject $subject Subject observed that contains event to write
  *
  * @return void
  */
 public function update(SplSubject $subject)
 {
     $this->subject = $subject;
     $event = $subject->getEvent();
     // delegate to right event implementation
     $data = call_user_func(array($this, $event->getName()), $event);
     if (empty($data)) {
         return;
     }
     $this->growl->publish($data['name'], $data['title'], $data['description'], $data['options']);
 }
开发者ID:remicollet,项目名称:php-compat-info,代码行数:18,代码来源:Growl.php

示例4: update

 /**
  * Method to trigger events.
  * The method first generates the even from the argument array. Then it unsets the argument
  * since the argument has no bearing on the event handler.
  * If the method exists it is called and returns its return value. If it does not exist it
  * returns null.
  *
  * @param   array  &$args  Arguments
  *
  * @return  mixed  Routine return value
  */
 public function update(SplSubject $subject)
 {
     // get the event and args from the subject (dispatcher) to use in the plugin
     $event = $subject->getEvent();
     $args = $subject->getArgs();
     /*
      * If the method to handle an event exists, call it and return its value
      * If it does not exist, return null.
      */
     if (method_exists($this, $event)) {
         return call_user_func_array(array($this, $event), $args);
     } else {
         return null;
     }
 }
开发者ID:ngchie,项目名称:system,代码行数:26,代码来源:Observer.php


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