post() public méthode

The purpose of the optional associated object is generally to pass the object posting the notification to the observers, so that the observers can query the posting object for more information about the event. Notifications are by default added to a pending notification list. This way, if an observer is not registered by the time they are posted, it will still be notified when it is added as an observer. This behaviour can be turned off in order to make sure that only the registered observers will be notified. The info array serves as a container for any kind of useful information. It is added to the notification object and posted along.
public post ( &$object, $nName, $info = [], $pending = true, $bubble = true ) : object
Résultat object The notification object
Exemple #1
0
 /**
  * This logs the user out and destroys the session object if the
  * configuration option is set.
  *
  * @param bool  set to false if no events should be fired b yhte logout
  * @return bool true on success or false on failure
  *
  * @access public
  */
 function logout($direct = true)
 {
     $this->_status = LIVEUSER_STATUS_LOGGEDOUT;
     if ($direct) {
         // trigger event 'onLogout' as replacement for logout callback function
         $this->dispatcher->post($this, 'onLogout');
         // If there's a cookie and the session hasn't idled or expired, kill that one too...
         $this->deleteRememberCookie();
     }
     // If the session should be destroyed, do so now...
     if ($this->_options['logout']['destroy']) {
         session_unset();
         session_destroy();
         if ($this->_options['session']['force_start']) {
             $this->_startSession();
         }
     } elseif (array_key_exists($this->_options['session']['varname'], $_SESSION)) {
         unset($_SESSION[$this->_options['session']['varname']]);
     }
     $this->disconnect();
     if ($direct) {
         // trigger event 'postLogout', can be used to do a redirect
         $this->dispatcher->post($this, 'postLogout');
     }
     return true;
 }