You are here

protected function IpIsBanned::doEvaluate in Rules 8.3

Checks if an IP address is banned.

Parameters

string $ip: The IP address to check.

Return value

bool TRUE if the IP address is banned.

File

src/Plugin/Condition/IpIsBanned.php, line 87

Class

IpIsBanned
Provides an 'IP address is blocked' condition.

Namespace

Drupal\rules\Plugin\Condition

Code

protected function doEvaluate($ip = NULL) {
  if (!isset($ip)) {
    $ip = $this->requestStack
      ->getCurrentRequest()
      ->getClientIp();
  }
  return $this->banManager
    ->isBanned($ip);
}