You are here

public function BanIpManager::isBanned in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/ban/src/BanIpManager.php \Drupal\ban\BanIpManager::isBanned()

Returns if this IP address is banned.

Parameters

string $ip: The IP address to check.

Return value

bool TRUE if the IP address is banned, FALSE otherwise.

Overrides BanIpManagerInterface::isBanned

File

core/modules/ban/src/BanIpManager.php, line 32

Class

BanIpManager
Ban IP manager.

Namespace

Drupal\ban

Code

public function isBanned($ip) {
  return (bool) $this->connection
    ->query("SELECT * FROM {ban_ip} WHERE ip = :ip", [
    ':ip' => $ip,
  ])
    ->fetchField();
}