logout() public method

This will remove authentication-related session data. If $destroySession is true, all session data will be removed.
public logout ( boolean $destroySession = true ) : boolean
$destroySession boolean whether to destroy the whole session. Defaults to true. This parameter is ignored if [[enableSession]] is false.
return boolean whether the user is logged out
Example #1
0
 public function logout($destroySession = true)
 {
     if (!$this->getIsGuest()) {
         /** @type IdentityAuthTrait $identity */
         $identity = $this->getIdentity();
         return $identity->deleteToken($this->tokenType);
     }
     return parent::logout($destroySession);
 }