function IpIsBanned::doEvaluate

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);
}