Implements Drupal\Core\Flood\FloodInterface::isAllowed().
Overrides FloodInterface::isAllowed
public function isAllowed($name, $threshold, $window = 3600, $identifier = NULL) {
if (!isset($identifier)) {
$identifier = $this->request
->getClientIp();
}
$number = $this->connection
->select('flood', 'f')
->condition('event', $name)
->condition('identifier', $identifier)
->condition('timestamp', REQUEST_TIME - $window, '>')
->countQuery()
->execute()
->fetchField();
return $number < $threshold;
}