You are here

public function FloodUnblockManager::isBlocked in Flood control 2.0.x

Provides identifier's flood status.

Parameters

string $event: The flood event name.

string $identifier: The identifier: IP address and/or UID.

Return value

bool Whether the identifier is blocked.

Overrides FloodUnblockManagerInterface::isBlocked

File

src/FloodUnblockManager.php, line 193

Class

FloodUnblockManager
Provides Flood Unblock actions.

Namespace

Drupal\flood_control

Code

public function isBlocked($identifier, $event) {
  $type = $this
    ->getEventType($event);
  switch ($type) {
    case 'user':
      return !$this->flood
        ->isAllowed($event, $this->config
        ->get('user_limit'), $this->config
        ->get('user_window'), $identifier);
    case 'ip':
      return !$this->flood
        ->isAllowed($event, $this->config
        ->get('ip_limit'), $this->config
        ->get('ip_window'), $identifier);
  }
  return FALSE;
}