示例#1
0
 /**
  * Gets data from $_oSubject object
  *
  * @param \SplSubject $_oSubject Action object
  * @return void
  */
 function update(\SplSubject $_oSubject)
 {
     $iMicroSec = $_oSubject->getEndTime() - $_oSubject->getStartTime();
     $iSec = number_format($iMicroSec, 10, '.', ' ');
     $aArguments = $_oSubject->getArgs();
     $xResult = $_oSubject->getResult();
     array_unshift(self::$_aLog, array('action' => get_class($_oSubject), 'time_msec' => $iMicroSec, 'time_sec' => $iSec, 'args' => $aArguments, 'result' => $xResult));
 }
示例#2
0
 /**
  * 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;
     }
 }
示例#3
0
 /**
  * The required update() function from SplObserver.
  * 
  * @param SplSubjectAdapter The SplSubjectAdapter object.
  * @return void
  */
 public function update(SplSubject $subject)
 {
     call_user_func_array($this->_function, $subject->getArgs());
 }