public function UserFloodEvent::__construct in Drupal 9
Constructs a user flood event object.
Parameters
string $name: The name of the flood event.
int $threshold: The threshold for the flood event.
int $window: The window for the flood event.
string $identifier: The identifier of the flood event.
File
- core/
modules/ user/ src/ Event/ UserFloodEvent.php, line 66
Class
- UserFloodEvent
- Provides a user flood event for event listeners.
Namespace
Drupal\user\EventCode
public function __construct($name, $threshold, $window, $identifier) {
$this->name = $name;
$this->threshold = $threshold;
$this->window = $window;
$this->identifier = $identifier;
// The identifier could be a uid or an IP, or a composite of both.
if (is_numeric($identifier)) {
$this->uid = $identifier;
return;
}
if (strpos($identifier, '-') !== FALSE) {
list($uid, $ip) = explode('-', $identifier);
$this->uid = $uid;
$this->ip = $ip;
return;
}
$this->ip = $identifier;
}