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