class SessionLimitDisconnectEvent in Session Limit 8
Same name and namespace in other branches
- 2.x src/Event/SessionLimitDisconnectEvent.php \Drupal\session_limit\Event\SessionLimitDisconnectEvent
Hierarchy
- class \Drupal\session_limit\Event\SessionLimitDisconnectEvent extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of SessionLimitDisconnectEvent
1 file declares its use of SessionLimitDisconnectEvent
- SessionLimit.php in src/
Services/ SessionLimit.php
File
- src/
Event/ SessionLimitDisconnectEvent.php, line 8
Namespace
Drupal\session_limit\EventView source
class SessionLimitDisconnectEvent extends Event {
/**
* @var int
*/
protected $sessionId;
/**
* @var SessionLimitCollisionEvent
*/
protected $collisionEvent;
/**
* @var bool
*/
protected $preventDisconnect = FALSE;
/**
* @var string
*/
protected $message;
/**
* SessionLimitCollisionEvent constructor.
*
* @param int $sessionId
* @param SessionLimitCollisionEvent $collisionEvent
* @param string $message
*/
public function __construct($sessionId, SessionLimitCollisionEvent $collisionEvent, $message) {
$this->sessionId = $sessionId;
$this->collisionEvent = $collisionEvent;
$this->message = $message;
}
/**
* @return int
*/
public function getSessionId() {
return $this->sessionId;
}
/**
* @return SessionLimitCollisionEvent
*/
public function getCollisionEvent() {
return $this->collisionEvent;
}
/**
* Call to prevent the session being disconnected.
*
* @param bool $state
* Set to TRUE to prevent the disconnection (default) any other
* value is ignored. Just one listener to the event calling this will
* prevent the disconnection.
*/
public function preventDisconnect($state = TRUE) {
$this->preventDisconnect = !empty($state) ? TRUE : $this->preventDisconnect;
}
/**
* Determine if the session disconnection should be prevented.
*
* @return bool
*/
public function shouldPreventDisconnect() {
return $this->preventDisconnect;
}
/**
* Get the message the user will see when their session is ended.
*
* @return string
*/
public function getMessage() {
return $this->message;
}
/**
* Set the message the user sees when their session is ended.
*
* @param string $message
* @return $this
*/
public function setMessage($message) {
$this->message = $message;
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SessionLimitDisconnectEvent:: |
protected | property | ||
SessionLimitDisconnectEvent:: |
protected | property | ||
SessionLimitDisconnectEvent:: |
protected | property | ||
SessionLimitDisconnectEvent:: |
protected | property | ||
SessionLimitDisconnectEvent:: |
public | function | ||
SessionLimitDisconnectEvent:: |
public | function | Get the message the user will see when their session is ended. | |
SessionLimitDisconnectEvent:: |
public | function | ||
SessionLimitDisconnectEvent:: |
public | function | Call to prevent the session being disconnected. | |
SessionLimitDisconnectEvent:: |
public | function | Set the message the user sees when their session is ended. | |
SessionLimitDisconnectEvent:: |
public | function | Determine if the session disconnection should be prevented. | |
SessionLimitDisconnectEvent:: |
public | function | SessionLimitCollisionEvent constructor. |