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();
}
$limit = microtime(true) - $window;
$number = count(array_filter($this->events[$name][$identifier], function ($timestamp) use ($limit) {
return $timestamp > $limit;
}));
return $number < $threshold;
}